万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    TypeScriptとReact/Next.jsでつくる 実践Webアプリケーション開発でエラー出た

    P113の話、 ch03/next-samplenpm run buildで、

    > next-sample@0.1.0 build
    > next build
    
    info  - SWC minify release candidate enabled. https://nextjs.link/swcmin
    
    Failed to compile.
    
    ./pages/api/hello.ts
    8:1  Warning: Assign arrow function to a variable before exporting as module default  import/no-anonymous-default-export
    
    ./pages/image-sample.tsx
    12:7  Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element
    12:7  Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.  jsx-a11y/alt-text
    16:7  Warning: Image elements must have an alt prop, either with meaningful text, or an empty string for decorative images.  jsx-a11y/alt-text
    
    ./pages/link.tsx
    39:6  Warning: React Hook useEffect has a missing dependency: 'router.events'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
    47:35  Error: `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`.  react/no-unescaped-entities
    47:40  Error: `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`.  react/no-unescaped-entities
    54:35  Error: `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`.  react/no-unescaped-entities
    54:41  Error: `"` can be escaped with `&quot;`, `&ldquo;`, `&#34;`, `&rdquo;`.  react/no-unescaped-entities

    この変なエラー。 react/no-unescaped-entitiesルールの仕業?

    https://stackoverflow.com/questions/43177074/how-to-fix-this-violation-of-this-react-no-unescaped-entitie-of-eslint-rule

    .eslintrc.jsonってファイルの

    {
      "extends": "next/core-web-vitals"
    }

    って書いてるのを

      "rules": { "react/no-unescaped-entities": 0 }

    追加する。

    つまり

    {
      "extends": "next/core-web-vitals",
      "rules": { "react/no-unescaped-entities": 0 }
    }

    カンマ忘れず。

    これでnpm run build行けた。

    Flutterのflutter.minSdkVersionとの戦い

    これがうぜー。

     /Users/shinriyo/development/flutter_apps/joyreco/android/app/build.gradle:                    │
    │ android {                                                                                     │
    │   defaultConfig {                                                                             │
    │     minSdkVersion 19                                                                          │
    │   }                                                                                           │
    │ }                                                                                             │
    │        
            // You can update the following values to match your application needs.
            // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
            minSdkVersion flutter.minSdkVersion
            targetSdkVersion flutter.targetSdkVersion

    flutter.minSdkVersion を直接書き換えるのも変。

    android/local.properties

    flutter.minSdkVersion=26

    って追加したらいけるっておもったら行けない。 ここに書いた場合は、

    minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()

    みたいに書かないと android/local.propertiesファイルが呼ばれないっぽい・・・。 ちなみに.toInteger()はつけなくてもいいらしい。

    元々flutter.minSdkVersionって書いてたのを書き換えるのもなんか流儀に反してるような気が・・・。

    この記事を参考にした。 FlutterでAndroidのbuildをしたらエラーが出た!

    記事では、/Users/hashimotojunichi/Development/flutter/packages/flutter_tools/gradle

    僕は fvm 使っているので、 /Users/shinriyo/fvm/versions/3.0.5の中にある 3.0.5/flutter/に相当するので、

    /Users/shinriyo/fvm/versions/3.0.5/packages/flutter_tools/gradle/flutter.gradle にあった。

        //static int minSdkVersion = 16
        static int minSdkVersion = 21

    に書き換えたらOK!I