gpt4 book ai didi

java - Android-如何消除这些gradle/proguard警告?

转载 作者:行者123 更新时间:2023-12-03 06:01:29 26 4
gpt4 key购买 nike

已经尝试过
-keepattributes封装方法
和-dontwarn内部类
在proguard-rules.pro上没有成功:(
你们有什么秘诀吗?

Information:Gradle tasks [:app:assembleMobilePFDebug] Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(net.lingala.zip4j.util.ArchiveMaintainer$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:(net.lingala.zip4j.util.ArchiveMaintainer$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:(net.lingala.zip4j.unzip.Unzip$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:(net.lingala.zip4j.unzip.Unzip$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:(net.lingala.zip4j.zip.ZipEngine$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:(com.samsung.android.sdk.pass.c) 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:(com.samsung.android.sdk.pass.d) 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:(com.samsung.android.sdk.pass.a) 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:(com.samsung.android.sdk.pass.b) 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:(com.samsung.android.sdk.pass.e) 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. Information:BUILD SUCCESSFUL Information:Total time: 1 mins 43.541 secs Information:80 errors Information:0 warnings Information:See complete output in console



Gradle文件(主要部分):
apply plugin: 'com.android.application'
apply plugin: 'jacoco'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

dexOptions{
maxProcessCount 3
javaMaxHeapSize "2g"
}

defaultConfig {
applicationId "com.xyz"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
multiDexEnabled true
}

buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

testOptions {
unitTests.returnDefaultValues = true
}

task jacocoTestReport(type: JacocoReport, dependsOn: "test"){

group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."

reports {
xml.enabled = true
html.enabled = true
}

classDirectories = fileTree(
dir: "./build/intermediates/classes/debug",
excludes: [ '**/R*.class',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$ViewInjector.class']
)

def coverageSourceDirs = [
"src/main/java"
]

sourceDirectories = files(coverageSourceDirs)
executionData = files("${project.buildDir}/jacoco/${jacocoTestReport}.exec")
}

productFlavors {
xyz {
applicationId "com.xyz"
versionName "1.2"
resValue "string", "app_name", "xyz"
versionCode "1"
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
testCompile fileTree(include: ['*.jar'], dir: 'libs/testLibs')
testCompile 'junit:junit:4.12'
androidTestCompile fileTree(include: ['*.jar'], dir: 'libs/androidTestLibs')
androidTestCompile 'com.android.support:support-annotations:23.4.0'
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'org.mockito:mockito-core:1.10.19'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
compile 'com.google.code.gson:gson:2.4'
compile files('libs/zip4j_1.3.2.jar')
}


android.applicationVariants.all { variant ->
variant.javaCompile.options.compilerArgs += [
'-AresourcePackageName=com.xyz'
]
}

java -version和&javac -version
Java版本“1.7.0_71”
Java(TM)SE运行时环境(内部版本1.7.0_71-b14)
Java HotSpot(TM)64位服务器VM(内部版本24.71-b01,混合模式)
javac 1.7.0_71

最佳答案

更新资料
尝试以下这一行:

-keepattributes InnerClasses,EnclosingMethod,Signature

此问题与此 post相似。基本上,您只需要将此行添加到您的proguard-rules.pro文件中:
-keepattributes EnclosingMethod

关于java - Android-如何消除这些gradle/proguard警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41386034/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com