Update Gradle to Version 7.0.2 - android

Updating Gradle from version 4.2.0 to 7.0.2. ended up in an error during minifying with R8. (Using Java 1.8)
Unfortunately, the error message is not very telling (see below).
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
at Version.fakeStackEntry(Version_3.0.69.java:0)
at com.android.tools.r8.utils.w.a(SourceFile:68)
at com.android.tools.r8.utils.w.a(SourceFile:28)
at com.android.tools.r8.utils.w.a(SourceFile:27)
at com.android.tools.r8.R8.a(R8.java:29)
at com.android.tools.r8.R8.run(R8.java:3)
at com.android.builder.dexing.R8Tool.runR8(r8Tool.kt:301)
at com.android.build.gradle.internal.tasks.R8Task$Companion.shrink(R8Task.kt:592)
at com.android.build.gradle.internal.tasks.R8Task.doTaskAction(R8Task.kt:443)
at com.android.build.gradle.internal.tasks.NonIncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(BaseTask.kt:63)
at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:51)
at com.android.build.gradle.internal.tasks.NonIncrementalTask.taskAction(NonIncrementalTask.kt:94)
at jdk.internal.reflect.GeneratedMethodAccessor512.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
... 118 more
Caused by: java.lang.NullPointerException: Cannot invoke "com.android.tools.r8.graph.B.F()" because "<parameter1>" is null
Did anybody face / solve the same problem?

Related

Gradle project sync failed in Flutter project

Every time my gradle is syncing it gets errors like this. Can someone help me?
Error cause after adding firebase_ml_vision dependency.
Caused by: org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
Caused by: java.lang.RuntimeException: com.android.build.gradle.internal.crash.ExternalApiUsageException: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:packLibsflutterBuildDebug'.
Caused by: com.android.build.gradle.internal.crash.ExternalApiUsageException: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:packLibsflutterBuildDebug'.
Caused by: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:packLibsflutterBuildDebug'.
org.codehaus.groovy.runtime.metaclass.MissingMethodExecutionFailed: No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [C:\Users\37499\AndroidStudioProjects\flutter_ml_demo\build\app\intermediates\flutter\debug]
I tried changing gradle, java and firebase versions but that don't help.

Anddroid: Execution failed for task ':libhos:kaptKotlin'

How can I resolve this error, I get this after upgrading my kotlin to 1.6.10
Is there any concrete way resolve this
Caused by: java.lang.IllegalStateException: Could not parse metadata! This should only happen if you're using Kotlin <1.1.
at com.squareup.moshi.kotlinpoet.metadata.KotlinPoetMetadata.readKotlinClassMetadata(KotlinPoetMetadata.kt:83)
at com.squareup.moshi.kotlinpoet.metadata.KotlinPoetMetadata.toImmutableKmClass(KotlinPoetMetadata.kt:113)
at com.squareup.moshi.kotlin.codegen.MoshiCachedClassInspector.toImmutableKmClass(MoshiCachedClassInspector.kt:37)
at com.squareup.moshi.kotlin.codegen.MetadataKt.targetType(metadata.kt:137)
at com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor.adapterGenerator(JsonClassCodegenProcessor.kt:148)
at com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor.process(JsonClassCodegenProcessor.kt:114)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt:90)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:188)

Room database is not working in mac book pro m1

Room database is not working in mac book pro m1
i have already added id 'kotlin-kapt'
screen shoot of android studio console log
What went wrong: Execution failed for task ':app:kaptDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
java.lang.reflect.InvocationTargetException (no error message)
Caused by: java.lang.reflect.InvocationTargetException at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at
org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:90)
at
org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:31)
at org.jetbrains.kotlin.kapt3.base.Kapt.kapt(Kapt.kt:45) ... 31 more
Caused by: java.lang.Exception: No native library is found for
os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64
at
org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:333)
at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:64)
at
androidx.room.verifier.DatabaseVerifier.(DatabaseVerifier.kt:71)
... 50 more
Simply use Room 2.4.0-alpha03
def room_version = "2.4.0-alpha03"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
Edit : The answer consisted of two solutions to solve the issue , since the above written solution was successful for many ,the other solution is removed .
add dependency:
kapt "org.xerial:sqlite-jdbc:3.34.0"

LibGDX game crash after migrating to Android Studio 3.4

After migrating to Android Studio 3.4, the game now crashed. It works fine on 3.3. What does this mean?
org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
at
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':android:transformDexWithInstantRunSlicesApkForDebug'
...
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: /Users/limtc/AndroidStudioProjects/Space War/android/build/intermediates/instant_run_split_apk_resources/debug/instantRunSplitApkResourcesDebug/out/slice_1/resources_ap
,,,
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /Users/limtc/AndroidStudioProjects/Space War/android/build/intermediates/instant_run_split_apk_resources/debug/instantRunSplitApkResourcesDebug/out/slice_1/resources_ap
...
Caused by: java.io.FileNotFoundException: /Users/limtc/AndroidStudioProjects/Space War/android/build/intermediates/instant_run_split_apk_resources/debug/instantRunSplitApkResourcesDebug/out/slice_1/resources_ap
...
After switching off instant run, I can now deploy to phone! But trying to generate bundle I now have:
org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
...
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':android:lintVitalRelease'
...
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':android:lintClassPath'.
...
Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download groovy-all.jar
Maybe now something goes offline? Thanks!
Based on the messages:
java.io.FileNotFoundException: /.../instant_run_split_apk_resources
I'd say, try disabling Instant Run.

D8 DexMergerTransform: flaky android builds on gitlab-ci

Since several days, I see flaky builds on my GitLab CI system.
Sometimes the build fails with this error:
Caused by: com.android.build.api.transform.TransformException: java.lang.IllegalArgumentException
at com.android.build.gradle.internal.transforms.DexMergerTransform.transform(DexMergerTransform.java:230)
When I then retry the build once or twice it works.
I know, this may be difficult to answer, so please add some comments, what I could try or which additional info you would need (unfortunately the project is not open-source): all comments/ideas are welcome.
Here are some thoughts that I have in mind:
maybe this is caused by insufficient memory (it's a quite large multi-module build)
maybe a timing issue of the build
maybe an error in the D8 Dexer
some more info:
the build is not doing any fancy stuff (android UI tests, etc.).
It just executes ./gradlew assembleDebug
com.android.tools.build:gradle 3.0.1
CompileSdkVersion: 26
Here are some relevant parts of the build-log:
> com.android.build.api.transform.TransformException: java.lang.IllegalArgumentException
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':m10_android_apk:transformDexArchiveWithDexMergerForRelease'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.lang.IllegalArgumentException
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:213)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
Caused by: com.android.build.api.transform.TransformException: java.lang.IllegalArgumentException
at com.android.build.gradle.internal.transforms.DexMergerTransform.transform(DexMergerTransform.java:230)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:222)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:218)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
... 116 more
Caused by: java.lang.IllegalArgumentException
at com.android.tools.r8.utils.ThreadUtils.getExecutorService(ThreadUtils.java:40)
at com.android.tools.r8.D8.runForTesting(D8.java:150)
at com.android.tools.r8.D8.run(D8.java:71)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:73)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:97)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:35)

Categories

Resources