Closed chickahoona closed 3 years ago
Thanks for reporting this issue. What version of Gradle did you install which caused the issue?
I tried with com.android.tools.build:gradle:4.0.1 and com.android.tools.build:gradle:4.0.2
You can check out the full source code here btw https://gitlab.com/psono/psono-app as its open source ;)
Seems to work on my machine. Here's what I did:
classpath 'com.android.tools.build:gradle:4.0.2'
I'm using Flutter 1.22.4 (latest stable) on MacOS
Am I missing something?
I was missing a crucial point. Try a flutter build apk
. Other commands, e.g. flutter build apk --debug
or flutter build appbundle
all passed without issues which is consistent with what other users reported.
That makes sense, and interestingly enough it works fine as well. I did run into another issue (Transform's input file does not exist) which was resolved using this workaround -> https://github.com/flutter/flutter/issues/58247#issuecomment-636500680
So first I did a flutter build apk --profile:
flutter build apk --profile
Signing with debug keys
Note: /Users/xx/Source/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.1+4/android/src/main/java/io/flutter/plugins/deviceinfo/DeviceInfoPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/xx/Source/flutter/.pub-cache/hosted/pub.dartlang.org/in_app_purchase-0.2.2+4/android/src/main/java/io/flutter/plugins/inapppurchase/InAppPurchasePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/xx/Source/flutter/.pub-cache/hosted/pub.dartlang.org/in_app_purchase-0.2.2+4/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/xx/Source/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.0+13/android/src/main/java/io/flutter/plugins/packageinfo/PackageInfoPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Running Gradle task 'assembleProfile'...
Running Gradle task 'assembleProfile'... Done 47.6s
✓ Built build/app/outputs/flutter-apk/app-profile.apk (33.5MB).
Followed by a build apk:
flutter build apk
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Signing with debug keys
WARNING: [Processor] Library '/Users/xx/.gradle/caches/modules-2/files-2.1/org.robolectric/shadows-framework/4.3/150103d5732c432906f6130b734e7452855dd67b/shadows-framework-4.3.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
Example of androidX reference: 'androidx/test/runner/lifecycle/Stage'
Example of support library reference: 'android/support/annotation/NonNull'
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 43.8s
✓ Built build/app/outputs/flutter-apk/app-release.apk (22.6MB).
Both builds with build.gradle set to 4.0.2
Try
git clone git@gitlab.com:psono/psono-app.git
adjust the grade version and then afterwards this:
docker run -v `pwd`/psono-app:/psono-app -it psono-docker.jfrog.io/openjdk:8-jdk /bin/bash
cd /psono-app
export ANDROID_COMPILE_SDK="29"
export ANDROID_BUILD_TOOLS="29.0.2"
export ANDROID_SDK_TOOLS="4333796"
export FLUTTER_VERSION="https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.22.4-stable.tar.xz"
apt-get --quiet update --yes
apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
unzip -d android-sdk-linux android-sdk.zip
echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
export ANDROID_HOME=$PWD/android-sdk-linux
export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
yes | android-sdk-linux/tools/bin/sdkmanager --licenses
wget --quiet --output-document=flutter-sdk.tar.xz $FLUTTER_VERSION
tar -xf flutter-sdk.tar.xz
export PATH=$PATH:$PWD/flutter/bin
echo flutter.sdk=$PWD/flutter > android/local.properties
flutter build apk
Thats exactly what ran in my build pipeline and I was also able to reproduce the issue locally.
Running other commands may "obfuscate" the issue, as for example running "--profile" was listed in one thread as a workaround.
Still works. Installed docker, followed all the steps, it takes forever to compile, but eventually it succeeds. The only extra step I took before I could execute flutter build apk
was to run flutter pub get
. Running flutter build without caused compilation errors.
Proof:
flutter build apk
You are building a fat APK that includes binaries for android-arm,
android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app
bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform
android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform
android-arm,android-arm64,android-x64 --split-per-abi
Learn more on:
https://developer.android.com/studio/build/configure-apk-splits#configur
e-abi-split
Signing with debug keys
Note: /psono-app/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.1+4/android/src/main/java/io/flutter/plugins/deviceinfo/DeviceInfoPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /psono-app/flutter/.pub-cache/hosted/pub.dartlang.org/in_app_purchase-0.2.2+4/android/src/main/java/io/flutter/plugins/inapppurchase/InAppPurchasePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /psono-app/flutter/.pub-cache/hosted/pub.dartlang.org/in_app_purchase-0.2.2+4/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /psono-app/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.0+13/android/src/main/java/io/flutter/plugins/packageinfo/PackageInfoPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Running Gradle task 'assembleRelease'...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
WARNING: [Processor] Library '/root/.gradle/caches/modules-2/files-2.1/io.flutter/flutter_embedding_debug/1.0.0-2c956a31c0a3d350827aee6c56bb63337c5b4e6e/d766fe2feb740ead017d002eae7d82dd4f337a93/flutter_embedding_debug-1.0.0-2c956a31c0a3d350827aee6c56bb63337c5b4e6e.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
Example of androidX reference: 'androidx/annotation/NonNull'
Example of support library reference: 'android/support/annotation/NonNull'
WARNING: [Processor] Library '/root/.gradle/caches/modules-2/files-2.1/io.flutter/flutter_embedding_profile/1.0.0-2c956a31c0a3d350827aee6c56bb63337c5b4e6e/83d8a0724d36e78214f1a7f4004a97b524f3202b/flutter_embedding_profile-1.0.0-2c956a31c0a3d350827aee6c56bb63337c5b4e6e.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
Example of androidX reference: 'androidx/annotation/NonNull'
Example of support library reference: 'android/support/annotation/NonNull'
WARNING: [Processor] Library '/root/.gradle/caches/modules-2/files-2.1/org.robolectric/shadows-framework/4.3/150103d5732c432906f6130b734e7452855dd67b/shadows-framework-4.3.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
Example of androidX reference: 'androidx/test/runner/lifecycle/Stage'
Example of support library reference: 'android/support/annotation/NonNull'
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 332.5s (!)
✓ Built build/app/outputs/flutter-apk/app-release.apk (22.7MB).
I'm closing this issue due to inactivity.
First I'd like to thank you for all your hard work. I really love your project and without it the Psono app would not be possible!
Now to the problem. I have recently upgraded gradle and so on yet now I receive this error:
Googling it brought be to this stackoverflow article.
https://stackoverflow.com/questions/33508777/gradle-error-in-android-studio-plugin-with-id-com-android-library-not-found/33513015
Which blames this line here https://github.com/firstfloorsoftware/flutter_sodium/blob/master/android/build.gradle#L1
I downgraded again to
com.android.tools.build:gradle:3.6.4
and things are working again.