android 修复“忽略InnerClasses属性”警告

8qgya5xd  于 2024-01-04  发布在  Android
关注(0)|答案(1)|浏览(171)

我想修复这个警告,给予我每次构建此输出:

  1. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  2. Error:(com.sun.jna.Native$1) that doesn't come with an
  3. Error:associated EnclosingMethod attribute. This class was probably produced by a
  4. Error:compiler that did not target the modern .class file format. The recommended
  5. Error:solution is to recompile the class from source, using an up-to-date compiler
  6. Error:and without specifying any "-target" type options. The consequence of ignoring
  7. Error:this warning is that reflective operations on this class will incorrectly
  8. Error:indicate that it is *not* an inner class.
  9. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  10. Error:(com.sun.jna.Native$2) that doesn't come with an
  11. Error:associated EnclosingMethod attribute. This class was probably produced by a
  12. Error:compiler that did not target the modern .class file format. The recommended
  13. Error:solution is to recompile the class from source, using an up-to-date compiler
  14. Error:and without specifying any "-target" type options. The consequence of ignoring
  15. Error:this warning is that reflective operations on this class will incorrectly
  16. Error:indicate that it is *not* an inner class.
  17. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  18. Error:(com.sun.jna.Native$3) that doesn't come with an
  19. Error:associated EnclosingMethod attribute. This class was probably produced by a
  20. Error:compiler that did not target the modern .class file format. The recommended
  21. Error:solution is to recompile the class from source, using an up-to-date compiler
  22. Error:and without specifying any "-target" type options. The consequence of ignoring
  23. Error:this warning is that reflective operations on this class will incorrectly
  24. Error:indicate that it is *not* an inner class.
  25. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  26. Error:(com.sun.jna.Native$4) that doesn't come with an
  27. Error:associated EnclosingMethod attribute. This class was probably produced by a
  28. Error:compiler that did not target the modern .class file format. The recommended
  29. Error:solution is to recompile the class from source, using an up-to-date compiler
  30. Error:and without specifying any "-target" type options. The consequence of ignoring
  31. Error:this warning is that reflective operations on this class will incorrectly
  32. Error:indicate that it is *not* an inner class.
  33. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  34. Error:(com.sun.jna.Native$5) that doesn't come with an
  35. Error:associated EnclosingMethod attribute. This class was probably produced by a
  36. Error:compiler that did not target the modern .class file format. The recommended
  37. Error:solution is to recompile the class from source, using an up-to-date compiler
  38. Error:and without specifying any "-target" type options. The consequence of ignoring
  39. Error:this warning is that reflective operations on this class will incorrectly
  40. Error:indicate that it is *not* an inner class.
  41. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  42. Error:(com.sun.jna.Native$6) that doesn't come with an
  43. Error:associated EnclosingMethod attribute. This class was probably produced by a
  44. Error:compiler that did not target the modern .class file format. The recommended
  45. Error:solution is to recompile the class from source, using an up-to-date compiler
  46. Error:and without specifying any "-target" type options. The consequence of ignoring
  47. Error:this warning is that reflective operations on this class will incorrectly
  48. Error:indicate that it is *not* an inner class.
  49. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  50. Error:(com.sun.jna.Native$7) that doesn't come with an
  51. Error:associated EnclosingMethod attribute. This class was probably produced by a
  52. Error:compiler that did not target the modern .class file format. The recommended
  53. Error:solution is to recompile the class from source, using an up-to-date compiler
  54. Error:and without specifying any "-target" type options. The consequence of ignoring
  55. Error:this warning is that reflective operations on this class will incorrectly
  56. Error:indicate that it is *not* an inner class.
  57. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  58. Error:(com.sun.jna.NativeLibrary$1) that doesn't come with an
  59. Error:associated EnclosingMethod attribute. This class was probably produced by a
  60. Error:compiler that did not target the modern .class file format. The recommended
  61. Error:solution is to recompile the class from source, using an up-to-date compiler
  62. Error:and without specifying any "-target" type options. The consequence of ignoring
  63. Error:this warning is that reflective operations on this class will incorrectly
  64. Error:indicate that it is *not* an inner class.
  65. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  66. Error:(com.sun.jna.NativeLibrary$2) that doesn't come with an
  67. Error:associated EnclosingMethod attribute. This class was probably produced by a
  68. Error:compiler that did not target the modern .class file format. The recommended
  69. Error:solution is to recompile the class from source, using an up-to-date compiler
  70. Error:and without specifying any "-target" type options. The consequence of ignoring
  71. Error:this warning is that reflective operations on this class will incorrectly
  72. Error:indicate that it is *not* an inner class.
  73. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  74. Error:(com.sun.jna.Structure$1) that doesn't come with an
  75. Error:associated EnclosingMethod attribute. This class was probably produced by a
  76. Error:compiler that did not target the modern .class file format. The recommended
  77. Error:solution is to recompile the class from source, using an up-to-date compiler
  78. Error:and without specifying any "-target" type options. The consequence of ignoring
  79. Error:this warning is that reflective operations on this class will incorrectly
  80. Error:indicate that it is *not* an inner class.
  81. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  82. Error:(com.sun.jna.win32.W32APITypeMapper$1) that doesn't come with an
  83. Error:associated EnclosingMethod attribute. This class was probably produced by a
  84. Error:compiler that did not target the modern .class file format. The recommended
  85. Error:solution is to recompile the class from source, using an up-to-date compiler
  86. Error:and without specifying any "-target" type options. The consequence of ignoring
  87. Error:this warning is that reflective operations on this class will incorrectly
  88. Error:indicate that it is *not* an inner class.
  89. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
  90. Error:(com.sun.jna.win32.W32APITypeMapper$2) that doesn't come with an
  91. Error:associated EnclosingMethod attribute. This class was probably produced by a
  92. Error:compiler that did not target the modern .class file format. The recommended
  93. Error:solution is to recompile the class from source, using an up-to-date compiler
  94. Error:and without specifying any "-target" type options. The consequence of ignoring
  95. Error:this warning is that reflective operations on this class will incorrectly
  96. Error:indicate that it is *not* an inner class.

字符串
我已经尝试了对这些问题的另一种解决方案:

这是我的build.gradle文件:

  1. apply plugin: 'com.android.application'
  2. apply plugin: 'com.neenbedankt.android-apt'
  3. android {
  4. compileSdkVersion 23
  5. buildToolsVersion "23.0.3"
  6. useLibrary 'org.apache.http.legacy'
  7. defaultConfig {
  8. applicationId "com.example.marco.myapp"
  9. minSdkVersion 16
  10. targetSdkVersion 23
  11. versionCode 1
  12. versionName "1.0"
  13. multiDexEnabled true
  14. }
  15. buildTypes {
  16. release {
  17. minifyEnabled false
  18. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  19. }
  20. }
  21. lintOptions {
  22. abortOnError false
  23. }
  24. dexOptions {
  25. preDexLibraries true
  26. javaMaxHeapSize "3g"
  27. incremental true
  28. dexInProcess = true
  29. }
  30. packagingOptions {
  31. exclude 'META-INF/services/javax.annotation.processing.Processor'
  32. exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
  33. exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
  34. }
  35. }
  36. dependencies {
  37. compile files('libs/slf4j-api-1.7.5.jar')
  38. //include jar libraries -> rstincanoffline dependencies
  39. compile fileTree(include: ['*.jar'], dir: 'libs')
  40. compile files('libs/slf4j-jdk14-1.7.5.jar')
  41. compile files('libs/tincan-0.3.1-SNAPSHOT-jar-with-dependencies-jarjar.jar')
  42. testCompile 'junit:junit:4.12'
  43. compile 'com.android.support:appcompat-v7:23.4.0'
  44. // stetho -> for debug purpose
  45. compile 'com.facebook.stetho:stetho:1.3.1'
  46. compile 'com.facebook.stetho:stetho-okhttp3:1.3.1'
  47. compile 'com.facebook.stetho:stetho-js-rhino:1.3.1'
  48. //gson dependency
  49. compile 'com.google.code.gson:gson:2.4'
  50. //google autovalue dependencies
  51. //apt 'com.google.auto.value:auto-value:1.1'
  52. compile 'com.google.auto.value:auto-value:1.2'
  53. apt 'com.google.guava:guava:19.0'
  54. provided 'org.glassfish:javax.annotation:10.0-b28'
  55. apt 'com.google.code.findbugs:jsr305:2.0.1'
  56. apt 'com.google.auto.service:auto-service:1.0-rc2'
  57. apt 'com.sun.jna:jna:3.0.9'
  58. //picasso dependency
  59. compile 'com.squareup.picasso:picasso:2.5.2'
  60. //realm dependency
  61. compile 'io.realm:realm-android:0.83.0+'
  62. }


如果有人能帮助我,那就太好了!

l5tcr1uw

l5tcr1uw1#

我通过修改proguard文件中的这一行来解决它:

  1. -keepattributes Signature,SourceFile,LineNumberTable

字符串
向以下各方:

  1. -keepattributes Signature,SourceFile,LineNumberTable,EnclosingMethod

相关问题