Flutter release version apk shows black screen OR Could not resolve all artifacts for configuration ':app:profileRuntimeClasspath'

Viewed 2323

I'm facing the problem of black screen in the release version of the app, the debug version works properly. When I install and open the release version of the app on the phone, it just shows black screen and nothing else.

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.18363.1198], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[√] Android Studio (version 3.6)
[√] Connected device (1 available)

• No issues found!

While I was building the release version of the apk I was getting the following error

Could not resolve all artifacts for configuration ':app:profileRuntimeClasspath'.
Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: D:\MY_PROJECTS\flutter_projects\sabr_health_app\build\app\intermediates\flutter\profile\libs.jar.
> Transform's input file does not exist: D:\MY_PROJECTS\flutter_projects\sabr_health_app\build\app\intermediates\flutter\profile\libs.jar.
1 Answers

I found the reason for the error:

I had updated Gradle wrapper distribution version to distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip in android/gradle/wrapper/gradle-wrapper.properties file.

AND

In android/build.gradle file, I had updated classpath 'com.android.tools.build:gradle:4.0.1'

.

.

Solution

Reverting back to distributionUrl=https://services.gradle.org/distributions/gradle-5.6.2-all.zip

AND

classpath 'com.android.tools.build:gradle:3.5.4'

Doing this solved my error. I think there is some issue with the higher gradle version.

Related