Unexpected failure during lint analysis of module-info.class - android

has anyone else seen this error:
Errors found:
/home/ligi/git/walleth/app/module-info.class: Error: Unexpected failure during lint analysis of module-info.class (this is a bug in lint or one of the libraries it depends on)
Stack: NullPointerException:InvalidPackageDetector.checkClass(InvalidPackageDetector.java:112)←AsmVisitor.runClassDetectors(AsmVisitor.java:154)←LintDriver.runClassDetectors(LintDriver.kt:1461)←LintDriver.checkClasses(LintDriver.kt:1329)←LintDriver.runFileDetectors(LintDriver.kt:1096)←LintDriver.checkProject(LintDriver.kt:895)←LintDriver.analyze(LintDriver.kt:416)←LintCliClient.run(LintCliClient.java:235)
You can set environment variable LINT_PRINT_STACKTRACE=true to dump a full stacktrace to stdout. [LintError]
Applies to variants: noGethNoFirebaseForFDroidOnlineDebug
/home/ligi/git/walleth/app/module-info.class: Error: Unexpected failure during lint analysis of module-info.class (this is a bug in lint or one of the libraries it depends on)
Stack: NullPointerException:
I only found this project facing the same problem:
https://github.com/mozilla-mobile/android-components/issues/1730
any workaround would be nice

The Android tooling for Android Studio 3.3 and earlier chokes on module-info.class files that are required by the Java Platform Module System (JPMS). Which is mind boggling considering that Java 9, the first version that shipped with the JPMS, came out in September 2017 and Java 11, the first LTS release with the JPMS, came out in September 2018, around 4 months before Android Studio 3.3. The relevant bug in the Android issue tracker: [lint] InvalidPackage crashes on module-info.class from byte-buddy
So, workarounds:
Upgrade the Android tooling to a beta of 3.4 or later. I tested 3.4.0-beta05 on one of my projects and it worked well.
Downgrade whatever library you're using to a version that does not yet support the JPMS (i.e. does not include a module-info.java).

To ignore this error, I defined this in my lint.xml:
<issue id="LintError">
<ignore regexp=".*module-info\.class.*"/>
</issue>
The above mentioned workarounds did not work for me:
Updating Android build tools to 3.4.1 didn't help
I couldn't downgrade the dependency that lead to this problem

Related

Xamarin Android google libraries defining the same class

I updated the libraries on my Xamarin Android application, and I get the following error:
com.google.android.gms.internal.ads.zza is defined multiple times: obj\Debug\120\lp\107\jl\bin\classes.jar:com/google/android/gms/internal/ads/zza.class, obj\Debug\120\lp\116\jl\bin\classes.jar:com/google/android/gms/internal/ads/zza.class
Here are the libraries that collide based on the manifest files found in these folders:
com.google.android.gms.gass -> Xamarin.GooglePlayServices.Gass version 120.0.0.7
com.google.android.gms.ads.impl -> I assume it's Xamarin.GooglePlayServices.Ads version 121.3.0
Is there any thoughts how can I overcome this issue? My app does not build. I tried many version combinations, none of them helped.
I tried many version combinations, none of them helped.
I have checked the android natived library: com.google.android.gms:play-services-gass 20.0.0, its last updated time is Apr 07, 2021. This is the Xamarin.GooglePlayServices.Gass nuget package 120.0.0.x in the xamarin.
And the native library com.google.android.gms: play-services-ads version 20.0.0 is published at Apr 05, 2021. So I created a sample to test the two nuget packages:
Xamarin.GooglePlayServices.Ads version 120.0.0
Xamarin.GooglePlayServices.Gass version 120.0.0.7
The error message disappeared. In addition, you can also uninstall the Xamarin.GooglePlayServices.Gass and only use the Xamarin.GooglePlayServices.Ads version 121.3.0, it should contains the api in the Xamarin.GooglePlayServices.Gass.

Jacoco java.lang.instrument.IllegalClassFormatException: Error while instrumenting Class

I recently moved to another computer and needed to reset all my environment.
So, this tests was working before.
But I didnt remember which version of Java/JDK I was using before.
Well, the problem is:
java.lang.instrument.IllegalClassFormatException: Error while instrumenting path/to/class
I'm using Jacoco "0.8.1"
java --version
openjdk 17.0.1 2021-10-19
and JDK 1.8
Can anyone know how to handle with it?
Strange to see statement
and JDK 1.8
together with
java --version
openjdk 17.0.1 2021-10-19
from the last one seems that actually you're using JDK 17
I'm using Jacoco "0.8.1"
We (developers of JaCoCo) advice to always use latest released version as new versions come with fixes and improvements (IMO updating versions of your dependencies and tools - is a very good practice also in general), so please try this - as of today latest released JaCoCo version is 0.8.7, and exactly in this version JDK 17 support was added.
Java 17 need jacoco 0.8.8 and above. reload pom.xml and it works
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
</plugin>
While I was Testing my build in cmd using the command mvnw test, i got "Build Erorr" java.lang.instrument.IllegalClassFormatException: Error while instrumenting sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo.
Step to perform:
1.Where to analyse the error.
Always check for build error or any test report under project folder /target/surefire-reports.
As this a build erorr checkin the dump file
Check for error message . In this particular scenario the error message is
"Jacocojava.lang.instrument.IllegalClassFormatException: Error while instrumenting sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo"
2.Investigate what is causing this error. The java version i had is 17 and Jacoco version i had is 0.8.5. So check your java verison and Jacoco verison
3.Checking java version Cmd enter java - version : it will display the version
example C:\Automation\projectJenkins\jgsu-spring-petclinic>java -version
java version "17.0.6" 2023-01-17 LTS
4.For java 15 and above the jococ version compatable is 0.8.7.
Open the pom file of your project and update jococ version. check under Generic properties . Update you version as 0.8.7
example:
<jacoco.version>0.8.7</jacoco.version>
save the file
last step. test your build.
cmd run MVNW test .
The issue was reolved and succesfull build was built.

Meaning of "android.enableAapt2 will be removed at the end of 2018"?

Gradle version: 4.4
Android Plugin Version: 3.1.2
Hi.
I'm working on an Android which should be deploy by using a Mobile Device Management called AirWatch.
So since Android Gradle Plugin 3.0.0, even if I update application version code and version name, the MDM thinks that the last deployed version and the current one are the same.
Using dump badging command, I see that the platformBuildVersionName is empty. So when I disable aapt2 from my gradle properties file, platformBuildVersionName is filled. which allow me to deploy on the MDM. The problem is not up to date we don't when they will. So this is the work around I found. I know that the option 'android.enableAapt2' is deprecated and should not be used anymore.
My question is what's the meaning "It will be removed at the end of 2018"? Is that mean, at the end of 2018, my app will not compile anymore?
Thanks
The issue with platformBuildVersionName missing has been fixed recently in AAPT2.
AAPT2 it is now released it in GMaven for faster releases (so you need to have the google() dependency in your build.gradle file), so please try with android gradle plugin 3.2.0 alpha16 or newer which may already contain it. If that still doesn't work, keep an eye out for new versions, it should be released shortly (if it hasn't been yet).
As for the information about AAPT1 deprecation - it means that at some point in the near future, near the end of 2018, there will be a release of Android Gradle Plugin that removes the android.enableAapt2=false flag. AAPT1 will be completely removed then so the hacks with disabling AAPT2 won't work anymore. If you run into any other issues with AAPT2 please file them on issue tracker, so that the team can fix them before everyone will need to move away from AAPT1.
In 2019 New update
From Gradle.properties remove
android.enableAapt2=false this line
it will work now.
1.Projenin gradle.properties:
android.enableAapt2=false
2.File-> settings-Build, Execution > Instant run
unselected all options and rebuild projects

'Failed to transform" error after migrating to AndroidX

I'm using Android Studio 3.2 Canary 14 and am trying to migrate an existing project to use AndroidX. It sounds from https://developer.android.com/topic/libraries/support-library/androidx-rn that I have to have set android.enableJetifier=true (this was done automatically for me when selecting "Refactor to AndroidX.." option). I've also updated target API level to 28. Anyone else seeing this issue?
Failed to transform
'/Users/jooreill/.gradle/caches/modules-2/files-2.1/com.google.firebase/firebase-perf/15.0.0/6e68f6e44b0c9d91756f903547ee3853349ae666/firebase-perf-15.0.0.aar' using Jetifier. Reason: null. (Run with --stacktrace for more
details.) To disable Jetifier, set android.enableJetifier=false in
your gradle.properties file.
The above error occurs when I run "Clean". In general am getting multiple errors like following if a do gradle sync:
Unable to resolve dependency for
':app-instant#debug/compileClasspath': Failed to transform file
'play-services-measurement-base-15.0.2.aar' to match attributes
{artifactType=jetified-aar} using transform JetifyTransform
For those experiencing the same issue with Android Studio 3.2 Canary 15 (or later) after using "Refactor to AndroidX...":
I had to update some dependencies manually, i.e. change
classpath 'io.fabric.tools:gradle:1.25.1'
to
classpath 'io.fabric.tools:gradle:1.27.0'
in my project's build.gradle file.
If you're using dagger you have to upgrade to version 2.20 or later.
This is because some libraries are not yet compatible with the AndroidX refactor as mentioned under Known issues in the AndroidX release notes.
I had been experiencing this problem while running assembleAndroidTest on Jenkins.
The weirdest part was that this task ran sans any issues on my mac's terminal without any issues, but failed on Jenkins with-
Failed to transform file 'cucumber-java-1.2.5.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
Had been looking for solutions for a couple of days now, having worked though different suggestions - none of which worked.
Finally, disabling Jetifier in gradle.properties resolved it for me.
android.enableJetifier=false
I was able to work around a similar problem by excluding a certain library from being jetified, which can be done by adding to gradle.properties:
android.jetifier.blacklist = ...
Note that this option was added in Android Gradle plugin 3.3.0-rc01 as a temporary workaround.
See https://issuetracker.google.com/issues/119135578#comment5 for more details.
As per a statement on the AndroidX refactor made by a Google Engineer (Support Library) during the I/O session "What's New in Support Library?", Google already discovered bugs related to Jetifier in Android Studio 3.2 Canary 14.
Thus, it is advised to wait until Canary 15 (to be released the coming week) before starting the AndroidX migration process.
I had this same error after adding JDK 11 to my machine. It set itself as default JDK and this error started happening.
After setting JDK 8 as default, it was fixed.

New errors after installation of fabric plugin in eclipse android

I use eclipse LUNA for android development. I installed Fabric plugin to add crashanalytics today and suddenly I am seeing some error which I am not able to identify.
The project shows red mark for errors but none of the files have the same error mark
And when I try to run/build the project I get the following error
An internal error occurred during: "Running GTM diagnose".
com.android.tools.lint.detector.api.XmlContext: method (Lcom/android/tools/lint/client/api/LintDriver;Lcom/android/tools/lint/detector/api/Project;Lcom/android/tools/lint/detector/api/Project;Ljava/io/File;Lcom/android/resources/ResourceFolderType;)V not found
Also i am seeing this error repeatedly in the console
[2014-12-05 08:56:41 - com-crashlytics-sdk-android_answers] Unable to resolve target 'android-21'
[2014-12-05 08:56:41 - com-crashlytics-sdk-android_crashlytics] Unable to resolve target 'android-21'
This is my first android project so sorry if this is a noob question. Any help would be appreciated
After installing SDK version 21, you will have this issue:
You are building your app with a sdkTarget defined in your manifest with a value lower than 21.
Your choices are:
a) upgrade your project to use: android:targetSdkVersion="21"
OR
b) change each crashlytics kit's manifest's targetSdkVersion to match your project

Categories

Resources