万年素人からHackerへの道

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

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

    ビルド失敗

    以下のエラーが出る。

    Launching lib/main.dart on Pixel 3a in debug mode...
    [!] Your app isn't using AndroidX.
        To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY.
    Running Gradle task 'assembleDebug'...
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:processDebugResources'.
    > Android resource linking failed
      Output:  /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:186: error: resource android:attr/fontVariationSettings not found.
      /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:187: error: resource android:attr/ttcIndex not found.
      error: failed linking references.
    
      Command: /Users/shinriyo/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/cf15aaf3329ecd741f3a7b23edd265f5/aapt2-3.2.1-4818971-osx/aapt2 link -I\
              /Users/shinriyo/Library/Android/sdk/platforms/android-27/android.jar\
              --manifest\
              /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
              -o\
              /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
              -R\
              @/Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
              --auto-add-overlay\
              --java\
              /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
              --custom-package\
              com.example.example\
              -0\
              apk\
              --output-text-symbols\
              /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/symbols/debug/R.txt\
              --no-version-vectors
      Daemon:  AAPT2 aapt2-3.2.1-4818971-osx Daemon #0
      Output:  /Users/shinriyo/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0.aar/d08d5771368b94287c50e67f3f752a2d/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.
    
      /Users/shinriyo/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0.aar/d08d5771368b94287c50e67f3f752a2d/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.
    
      error: failed linking references.
      Command: /Users/shinriyo/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/cf15aaf3329ecd741f3a7b23edd265f5/aapt2-3.2.1-4818971-osx/aapt2 link -I\
              /Users/shinriyo/Library/Android/sdk/platforms/android-27/android.jar\
              --manifest\
              /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
              -o\
              /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
              -R\
              @/Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
              --auto-add-overlay\
              --java\
              /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
              --custom-package\
              com.example.example\
              -0\
              apk\
              --output-text-symbols\
              /Users/shinriyo/development/flutter_apps/flutter_keyboard_actions/example/build/app/intermediates/symbols/debug/R.txt\
              --no-version-vectors
      Daemon:  AAPT2 aapt2-3.2.1-4818971-osx Daemon #0
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 2s
    Finished with error: Gradle task assembleDebug failed with exit code 1

    この辺見る https://github.com/flutter/flutter/issues/27106

    flutter doctor -vするとライセンス云々

    [✓] Flutter (Channel master, v1.10.16-pre.4, on Mac OS X 10.15.2 19C57, locale en-JP)
        • Flutter version 1.10.16-pre.4 at /Users/shinriyo/development/flutter_apps/flutter
        • Framework revision ee032f67c7 (8 weeks ago), 2019-11-02 09:46:25 -0700
        • Engine revision 8ea19b1c76
        • Dart version 2.6.0 (build 2.6.0-dev.8.2 bbe2ac28c9)
    
    
    [!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
        • Android SDK at /Users/shinriyo/Library/Android/sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-28, build-tools 28.0.3
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
        ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
    
    [✓] Xcode - develop for iOS and macOS (Xcode 11.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 11.3, Build version 11C29
        • CocoaPods version 1.8.4
    
    [✓] Android Studio (version 3.5)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 42.1.1
        • Dart plugin version 191.8593
        • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    
    [!] IntelliJ IDEA Community Edition (version 2019.2.3)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        ✗ Flutter plugin not installed; this adds Flutter specific functionality.
        ✗ Dart plugin not installed; this adds Dart specific functionality.
        • For information about installing plugins, see
          https://flutter.dev/intellij-setup/#installing-the-plugins
    
    [✓] VS Code (version 1.41.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.7.1
    
    [✓] Connected device (1 available)
        • Pixel 3a • 94MAY0R3C8 • android-arm64 • Android 10 (API 29)
    flutter doctor --android-licenses
    android {
        compileSdkVersion 27
    
        lintOptions {
            disable 'InvalidPackage'

    これの2728

    slider

    https://stackoverflow.com/questions/53866967/how-to-create-a-carrousel-sliding-animation-with-pageview-in-flutter

    import 'package:page_indicator/page_indicator.dart';必要

    page_indicator: ^0.3.0

    これも違う。

        PageIndicatorContainer container = new PageIndicatorContainer(
          child: new PageView(
            children: _list,
    import 'package:flutter/material.dart';
    import 'package:page_indicator/page_indicator.dart';
    
    void main() => runApp(new Carousel());
    
    class Carousel extends StatefulWidget {
      _CarouselState createState() => _CarouselState();
    }
    
    class _CarouselState extends State<Carousel>
        with SingleTickerProviderStateMixin {
      final PageController _controller = PageController();
    
      List<Widget> _list = [
        SliderBox(
            child: FlutterLogo(
          colors: Colors.red,
        )),
        SliderBox(
            child: FlutterLogo(
          colors: Colors.green,
        )),
        SliderBox(
            child: FlutterLogo(
          colors: Colors.blue,
        ))
      ];
    
      @override
      void initState() {
        super.initState();
        WidgetsBinding.instance.addPostFrameCallback((_) => _animateSlider());
      }
    
      void _animateSlider() {
        Future.delayed(Duration(seconds: 2)).then((_) {
          int nextPage = _controller.page.round() + 1;
    
          if (nextPage == _list.length) {
            nextPage = 0;
          }
    
          _controller
              .animateToPage(nextPage,
                  duration: Duration(seconds: 1), curve: Curves.linear)
              .then((_) => _animateSlider());
        });
      }
    
      @override
      Widget build(BuildContext context) {
        PageIndicatorContainer container = new PageIndicatorContainer(
          child: new PageView(
            children: _list,
            controller: _controller,
          ),
          length: _list.length,
          padding: EdgeInsets.fromLTRB(10, 40, 10, 10),
          indicatorSpace: 10,
          indicatorColor: Colors.grey[350],
          indicatorSelectorColor: Colors.grey,
        );
    
        return Stack(
          children: <Widget>[
            Container(color: Colors.grey[100], height: double.infinity),
            Container(
                color: Colors.white,
                child: container,
                margin: EdgeInsets.only(bottom: 50)),
          ],
        );
      }
    }
    
    class SliderBox extends StatelessWidget {
      final Widget child;
      const SliderBox({Key key, this.child}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return Container(padding: EdgeInsets.all(10), child: child);
      }
    }
    import 'package:flutter/material.dart';
    import 'package:page_indicator/page_indicator.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Carousel(),
        );
      }
    }
    
    class Carousel extends StatefulWidget {
      _CarouselState createState() => _CarouselState();
    }
    
    class _CarouselState extends State<Carousel>
        with SingleTickerProviderStateMixin {
      final PageController _controller = PageController();
    
      List<Widget> _list = [
        SliderBox(
            index: 0,
            child: FlutterLogo(
              colors: Colors.red,
            )),
        SliderBox(
            index: 2,
            child: FlutterLogo(
              colors: Colors.green,
            )),
        SliderBox(
            index: 3,
            child: FlutterLogo(
              colors: Colors.blue,
            ))
      ];
    
      @override
      void initState() {
        super.initState();
    //    WidgetsBinding.instance.addPostFrameCallback((_) => _animateSlider());
      }
    
      void _animateSlider() {
        Future.delayed(Duration(seconds: 2)).then((_) {
          int nextPage = _controller.page.round() + 1;
    
          if (nextPage == _list.length) {
            nextPage = 0;
          }
    
          _controller
              .animateToPage(nextPage,
                  duration: Duration(seconds: 1), curve: Curves.linear)
              .then((_) => _animateSlider());
        });
      }
    
      @override
      Widget build(BuildContext context) {
        PageIndicatorContainer container = PageIndicatorContainer(
          child: PageView(
              children: _list,
              controller: _controller,
              onPageChanged: (page) {
                print(page);
              }),
          length: _list.length,
          padding: EdgeInsets.fromLTRB(10, 40, 10, 10),
          indicatorSpace: 10,
          indicatorColor: Colors.grey[350],
          indicatorSelectorColor: Colors.grey,
        );
    
        return Stack(
          children: <Widget>[
            Container(color: Colors.grey[100], height: double.infinity),
            Container(
                color: Colors.white,
                child: container,
                margin: EdgeInsets.only(bottom: 50)),
          ],
        );
      }
    }
    
    class SliderBox extends StatefulWidget {
      final int index;
      final Widget child;
      const SliderBox({Key key, this.index, this.child}) : super(key: key);
    
      @override
      _SliderBoxState createState() => _SliderBoxState();
    }
    
    class _SliderBoxState extends State<SliderBox>
        with SingleTickerProviderStateMixin {
      AnimationController _animationController;
    
      @override
      void initState() {
        super.initState();
        _animationController = AnimationController(
          vsync: this,
          duration: const Duration(milliseconds: 500),
        );
    
        _animationController.drive(
          AlignmentTween(
            begin: Alignment.topLeft,
            end: Alignment.bottomRight,
          ),
        );
      }
    
      @override
      Widget build(BuildContext context) {
        print(this.widget.index);
        return Container(
          padding: EdgeInsets.all(10),
          child: AlignTransition(
            alignment: _animationController
                .drive(
                  CurveTween(
                    curve: const Interval(0, 0.6, curve: Curves.fastOutSlowIn),
                  ),
                )
                .drive(
                  AlignmentTween(
                    begin: Alignment.topLeft,
                    end: Alignment.bottomRight,
                  ),
                ),
            child: widget.child,
          ),
        );
      }
    
      @override
      void dispose() {
        _animationController.dispose();
        super.dispose();
      }
    }