Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in gradle build after updating Android Studio with log4j

Tags:

I do get these errors after i updated Android Studio and the SDK:

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.ControlPanel$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.ControlPanel$2) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.ControlPanel$3) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.ControlPanel$4) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.ControlPanel$5) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.ControlPanel$6) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.ControlPanel$7) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.Main$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.MyTableModel$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.util.LogFileParser$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LF5SwingUtils$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$10) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$11) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$12) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$13) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$14) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$15) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$16) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$17) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$18) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$19) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$2) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$20) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$21) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$22) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$23) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$24) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$25) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$26) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$27) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.lf5.viewer.LogBrokerMonitor$28) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a 

Installed SDK:

All including rev. 25.1.2

Android Studio:

Android Studio 2.0 Build #AI-143.2739321, built on April 5, 2016 JRE: 1.7.0_80-b15 amd64

The build.gradle file of the project:

apply plugin: 'com.android.application'  android {  signingConfigs {     mulco {         storeFile file("somePath")         storePassword "..."         keyAlias "..."         keyPassword "..."     } }  compileSdkVersion 22 buildToolsVersion "22.0.1"  def versionPropertiesFile = file('version.properties') if (versionPropertiesFile.canRead()) {     def Properties versionProps = new Properties()     versionProps.load(new FileInputStream(versionPropertiesFile))     def code = versionProps['VERSION_CODE'].toInteger() + 1     versionProps['VERSION_CODE'] = code.toString()     println('count version up ' + code.toString())     versionProps.store(versionPropertiesFile.newWriter(), null)      defaultConfig {         multiDexEnabled true         signingConfig signingConfigs.mulco         applicationId "com.test.mulcoandroid"         minSdkVersion 19         targetSdkVersion 22         versionCode code         versionName "1.03.01"     } } else {     throw new GradleException("Could not read version.properties!") }  buildTypes {     release {         minifyEnabled false         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         signingConfig signingConfigs.mulco     }     debug {         debuggable true         signingConfig signingConfigs.mulco     } } packagingOptions {     exclude 'META-INF/LICENSE.txt'     exclude 'META-INF/NOTICE.txt' } }  dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     compile 'com.google.android.gms:play-services-maps:8.4.0'     compile project(':iCommonLibrary')     compile project(':mulcobluetooth')     compile project(':iScannerLibrary')     compile project(':iPictureLibrary')     compile 'com.android.support:multidex:1.0.1'     testCompile "junit:junit:4.12"     compile 'net.lingala.zip4j:zip4j:1.3.2' } 

and of the dependant iCommonLibrary:

apply plugin: 'com.android.library'  android { compileSdkVersion 22 buildToolsVersion "22.0.1"  defaultConfig {     multiDexEnabled true     minSdkVersion 16     targetSdkVersion 22     versionCode 1     versionName "1.0" } buildTypes {     release {         minifyEnabled false         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'     } }  packagingOptions {     exclude 'META-INF/LICENSE.txt'     exclude 'META-INF/NOTICE.txt' } }  dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     compile 'com.squareup.retrofit:retrofit:1.9.0'     compile 'com.squareup.okhttp:okhttp:2.5.0'     compile 'de.greenrobot:greendao:1.3.7'     compile 'commons-io:commons-io:2.4'     compile 'org.apache.commons:commons-lang3:3.3.2'     compile 'commons-codec:commons-codec:1.10'     compile 'de.mindpipe.android:android-logging-log4j:1.0.3'     compile 'org.slf4j:slf4j-api:1.6.4'     compile 'org.slf4j:slf4j-log4j12:1.6.4'     compile 'com.google.android.gms:play-services-location:8.4.0'     compile 'commons-net:commons-net:3.3'     compile 'com.jjoe64:graphview:4.0.1'     compile 'com.android.support:support-annotations:22.0.1' } 

build.gradle of iPictureLibrary:

apply plugin: 'com.android.library'  android { compileSdkVersion 22 buildToolsVersion "22.0.1"  defaultConfig {     minSdkVersion 19     targetSdkVersion 22     versionCode 1     versionName "1.0" } buildTypes {     release {         minifyEnabled false         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'     } } }  dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'     compile 'com.android.support:appcompat-v7:22.2.0'     compile 'com.jakewharton:disklrucache:2.0.2'     compile project(':iCommonLibrary') } 

build.gradle of iScannerLibrary:

apply plugin: 'com.android.library'  android { compileSdkVersion 22 buildToolsVersion "22.0.1"  defaultConfig {     minSdkVersion 16     targetSdkVersion 22     versionCode 1     versionName "1.0" } buildTypes {     release {         minifyEnabled false         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'     } } }  dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     compile 'com.google.zxing:core:3.2.1'     compile 'com.google.zxing:android-core:3.2.1'     compile files('libs/GrabbaSDK/Grabba driver for android v1.122.jar')     compile project(':iCommonLibrary') } 

build.gradle file of mulcobluetooth:

apply plugin: 'com.android.library'  android { compileSdkVersion 22 buildToolsVersion "22.0.1"  defaultConfig {     minSdkVersion 16     targetSdkVersion 22     versionCode 1     versionName "1.0" } buildTypes {     release {         minifyEnabled false         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'     } }  defaultConfig {     multiDexEnabled true } }  dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     compile 'org.apache.commons:commons-lang3:3.3.2'     compile 'commons-io:commons-io:2.4' } 

I hope i provided any important information

If someone does know anything ... please help me! I cannot find anything in this "NEULAND"

Sorry for the long question... Thanks for anyone who has made it up to here.

EDIT:

I updated the dependencies to:

compile 'org.apache.logging.log4j:log4j-core:2.5' compile 'org.slf4j:slf4j-api:1.7.21' compile 'org.slf4j:slf4j-log4j12:1.7.21' 

But nothing has changed. I still have about 500 build errors .... I deleted mindpipe as reference an coded it by myself ... Nothing happened!

EDIT:

Opened a ticket: Issue 206867

https://code.google.com/p/android/issues/detail?id=206867

EDIT:

After uninstall Android Studio 2.0 and install 1.5.1 again I get the following warning:

Warning:Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in C:\Sources\iRecyApps\iRecyMulco-1.0.1iOS\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip

So the gradle version was updated by 2...

I informed myself about the current gradle version and it's 2.12

I downloaded both and tried this:

You need to change File > Settings > Builds,Execution,Deployment > Build Tools > Gradle >Gradle home path

On Mac OS, change the path in Android Studio > Preferences > Builds,Execution,Deployment > Build Tools > Gradle >Gradle home

Or set Use default gradle wrapper and edit Project\gradle\wrapper\gradle-wrapper.properties files field distributionUrl like this

according to:

"Gradle Version 2.10 is required." Error

http://tools.android.com/tech-docs/new-build-system/version-compatibility

Still nothing

like image 619
Pwnstar Avatar asked Apr 13 '16 08:04

Pwnstar


People also ask

Is gradle affected by Log4j?

Several Gradle Enterprise products were impacted by the Log4j vulnerability. New versions of Gradle Enterprise, Test Distribution Agent and Build Cache Node were released December 13, 2021.

Why is my Gradle build failing?

If gradle --version works, but all of your builds fail with the same error, it is possible there is a problem with one of your Gradle build configuration scripts. You can verify the problem is with Gradle scripts by running gradle help which executes configuration scripts, but no Gradle tasks.

How do I fix build gradle?

For this, you have to connect your PC to the internet and you have to open your Android studio. After opening your project click on the Sync Project with Gradle files option. This will automatically download the new Gradle files and will fix the issue which is caused by the Gradle files.


2 Answers

Add this line to proguard-rules.pro

-keepattributes EnclosingMethod 

This error may happen almost all classes which has InnerClasses, I think. (like support.v4 etc) for me.


I've tested on Android studio 2.2
(Not tested log4j. Tested support.v4 etc.)

build.gradle

compileSdkVersion 24 buildToolsVersion "24.0.2" ... minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' ... dependencies {     ...     compile 'com.android.support:support-v4:24.2.1' } 

getDefaultProguardFile('proguard-android-optimize.txt') also works.

like image 123
Toris Avatar answered Sep 18 '22 20:09

Toris


I was also facing this same error. It was driving me crazy because the error count was >1K. And I was getting these errors on release build with proguard enabled.

After doing some digging I found that adding -keepattributes EnclosingMethod in your proguard-rules.pro file all these error will be gone.

Source: Thread and Issue #294 on GitHub.

like image 40
activesince93 Avatar answered Sep 17 '22 20:09

activesince93