Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build error #14

Open
a-h-mzd opened this issue Sep 29, 2019 · 7 comments
Open

build error #14

a-h-mzd opened this issue Sep 29, 2019 · 7 comments
Labels
bug Something isn't working

Comments

@a-h-mzd
Copy link

a-h-mzd commented Sep 29, 2019

this is what happens every time I try to run the app:

Initializing gradle... 1.2s
Resolving dependencies...

  • Error running Gradle:
    ProcessException: Process exited abnormally:

Configure project :app

Project evaluation failed including an error in afterEvaluate {}. Run with
--stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

  • Where:
    Script '/home/ehsan/FlutterSDK/packages/flutter_tools/gradle/flutter.gradle'
    line: 422

  • What went wrong:
    A problem occurred evaluating script.

Failed to apply plugin [class 'FlutterPlugin']
Invalid platform: android-arm64android.enableR8=true.

  • 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 0s
Command:
/home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection
/android/gradlew app:properties

Please review your Gradle project setup in the android/ folder.

@shaqian
Copy link
Owner

shaqian commented Oct 9, 2019

Hi amir,

The error is complaining invalid platform.

Failed to apply plugin [class 'FlutterPlugin']
Invalid platform: android-arm64android.enableR8=true.

"android-arm64android.enableR8=true" doesn't seem to be a correct value for platform. I think you need to remove "android.enableR8=true".

Thanks,
Qian

@a-h-mzd
Copy link
Author

a-h-mzd commented Oct 9, 2019

@shaqian thank you for your comment
I did what you said and removed android-arm64android.enableR8=true but now this happens:

Initializing gradle...                                              1.4s
Resolving dependencies...                                           3.5s
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:processDebugResources'.                 
> Android resource linking failed                                       
  Output:  /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:186: error: resource android:attr/fontVariationSettings not found.
  /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:187: error: resource android:attr/ttcIndex not found.
  error: failed linking references.                                     
                                                                        
  Command: /home/ehsan/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/05647e5f74f5556b7d64249da11cf870/aapt2-3.2.1-4818971-linux/aapt2 link -I\
          /home/ehsan/AndroidSDK/platforms/android-27/android.jar\      
          --manifest\                                                   
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
          -o\                                                           
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
          -R\                                                           
          @/home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\                                           
          --java\                                                       
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
          --custom-package\                                             
          com.example.examplerealtime\                                  
          -0\                                                           
          apk\                                                          
          -0\                                                           
          tflite\                                                       
          --output-text-symbols\                                        
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/symbols/debug/R.txt\
          --no-version-vectors                                          
  Daemon:  AAPT2 aapt2-3.2.1-4818971-linux Daemon #0                    
  Output:  /home/ehsan/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0.aar/0782d6151f711739d6a6fb9fc4604ea1/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.
                                                                        
  /home/ehsan/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0.aar/0782d6151f711739d6a6fb9fc4604ea1/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.
                                                                        
  error: failed linking references.                                     
  Command: /home/ehsan/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/05647e5f74f5556b7d64249da11cf870/aapt2-3.2.1-4818971-linux/aapt2 link -I\
          /home/ehsan/AndroidSDK/platforms/android-27/android.jar\      
          --manifest\                                                   
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
          -o\                                                           
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
          -R\                                                           
          @/home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\                                           
          --java\                                                       
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
          --custom-package\                                             
          com.example.examplerealtime\                                  
          -0\                                                           
          apk\                                                          
          -0\                                                           
          tflite\                                                       
          --output-text-symbols\                                        
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/symbols/debug/R.txt\
          --no-version-vectors                                          
  Daemon:  AAPT2 aapt2-3.2.1-4818971-linux 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 56s                                                     
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        57.6s
AndroidX incompatibilities may have caused this build to fail. 
Please migrate your app to AndroidX. See https://goo.gl/CP92wY.
Gradle task assembleDebug failed with exit code 1

@Franchute13
Copy link

@shaqian thank you for your comment
I did what you said and removed android-arm64android.enableR8=true but now this happens:

Initializing gradle...                                              1.4s
Resolving dependencies...                                           3.5s
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:processDebugResources'.                 
> Android resource linking failed                                       
  Output:  /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:186: error: resource android:attr/fontVariationSettings not found.
  /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:187: error: resource android:attr/ttcIndex not found.
  error: failed linking references.                                     
                                                                        
  Command: /home/ehsan/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/05647e5f74f5556b7d64249da11cf870/aapt2-3.2.1-4818971-linux/aapt2 link -I\
          /home/ehsan/AndroidSDK/platforms/android-27/android.jar\      
          --manifest\                                                   
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
          -o\                                                           
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
          -R\                                                           
          @/home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\                                           
          --java\                                                       
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
          --custom-package\                                             
          com.example.examplerealtime\                                  
          -0\                                                           
          apk\                                                          
          -0\                                                           
          tflite\                                                       
          --output-text-symbols\                                        
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/symbols/debug/R.txt\
          --no-version-vectors                                          
  Daemon:  AAPT2 aapt2-3.2.1-4818971-linux Daemon #0                    
  Output:  /home/ehsan/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0.aar/0782d6151f711739d6a6fb9fc4604ea1/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.
                                                                        
  /home/ehsan/.gradle/caches/transforms-1/files-1.1/support-compat-28.0.0.aar/0782d6151f711739d6a6fb9fc4604ea1/res/values/values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.
                                                                        
  error: failed linking references.                                     
  Command: /home/ehsan/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/05647e5f74f5556b7d64249da11cf870/aapt2-3.2.1-4818971-linux/aapt2 link -I\
          /home/ehsan/AndroidSDK/platforms/android-27/android.jar\      
          --manifest\                                                   
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
          -o\                                                           
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
          -R\                                                           
          @/home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\                                           
          --java\                                                       
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
          --custom-package\                                             
          com.example.examplerealtime\                                  
          -0\                                                           
          apk\                                                          
          -0\                                                           
          tflite\                                                       
          --output-text-symbols\                                        
          /home/ehsan/AndroidStudioProjects/external_projects/flutter_realtime_detection/build/app/intermediates/symbols/debug/R.txt\
          --no-version-vectors                                          
  Daemon:  AAPT2 aapt2-3.2.1-4818971-linux 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 56s                                                     
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        57.6s
AndroidX incompatibilities may have caused this build to fail. 
Please migrate your app to AndroidX. See https://goo.gl/CP92wY.
Gradle task assembleDebug failed with exit code 1

Same problem.

Emulator Nexus 4 api 22 and real device (Android 6)
Flutter (Channel stable, v1.12.13+hotfix.5, on Linux

@Franchute13
Copy link

I solved the problems

  1. Change compileSdkVersion = 28 or greater, the same targetSdkVersion
  2. Add
    packagingOptions {
    exclude 'META-INF / proguard / androidx-annotations.pro'
    }
    In bluid.gradle
  3. In main.dart, add
    WidgetsFlutterBinding.ensureInitialized ();
    on line 9

@LatteDev
Copy link

LatteDev commented Jan 6, 2020

hi,guys!
I successfully run this APP in Virtual Devices by doing blow Steps

  1. Change compileSdkVersion = 28 or higher, the same targetSdkVersion In app/build.gradle  ※Make Suer you have Installed target SDK!
  2. Migrate the Project to AndroindX by following guide
    https://flutter.cn/docs/development/androidx-migration
  3. In main.dart, add following Code on line 9;
    WidgetsFlutterBinding.ensureInitialized();

PS:

  1. I suggest to delete your existing project and download a clean one, and then do above steps....
  2. My enviroment is
  • Flutter 1.12.13+hotfix.5
  • android SDK 28
  • vscode
  • android studio ※Just for SDK download and androidx-migration

@spielers
Copy link

You can follow the following process to build the project without androidx error.
1} create a new flutter project in android studio
2}go to pubspec.yml and add a camera and tflite dependencies
3] go to app.gradle and change the compileSdkVersion = 28 or greater, the same targetSdkVersion
4} In main.dart, add the code given in the repository
5} create other dart files such as camera.dart , home.dart, models.dart, bndbox.dart and add the code
using the original files given in this repository
6} create a assets folder and add the path in pubspec.yml
7} add this to main.darton line 9;
WidgetsFlutterBinding.ensureInitialized();
8} now you can build the project

-Suraj Patil.

@shaqian shaqian added the bug Something isn't working label Apr 2, 2020
@shaqian
Copy link
Owner

shaqian commented Apr 6, 2020

Thank you all for the solution.

I received a PR for the issue as well. Refer to #21 for details.

Thanks,
Qian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants