Android Can';t生成有符号APK
我必须使用android studio创建一个应用程序,需要生成已签名的Apk,但当我生成已签名的Apk时,它将显示一些警告,并且生成失败。请帮助我解决此问题。这是我的错误日志文件Android Can';t生成有符号APK,android,android-studio,github,libraries,Android,Android Studio,Github,Libraries,我必须使用android studio创建一个应用程序,需要生成已签名的Apk,但当我生成已签名的Apk时,它将显示一些警告,并且生成失败。请帮助我解决此问题。这是我的错误日志文件 Information:Gradle tasks [:app:assembleRelease] Information:0 errors Information:0 warnings Information:See complete output in console Warning:com.kosalgeek.an
Information:Gradle tasks [:app:assembleRelease]
Information:0 errors
Information:0 warnings
Information:See complete output in console
Warning:com.kosalgeek.android.photoutil.MainActivity: can't find referenced class com.kosalgeek.android.photoutil.R$layout
Warning:com.kosalgeek.android.photoutil.MainActivity: can't find referenced class com.kosalgeek.android.photoutil.R$id
Warning:com.kosalgeek.android.photoutil.MainActivity: can't find referenced class com.kosalgeek.android.photoutil.R$menu
Warning:com.kosalgeek.android.photoutil.MainActivity: can't find referenced class com.kosalgeek.android.photoutil.R$id
Warning:com.kosalgeek.android.photoutil.MainActivity: can't find referenced class com.kosalgeek.android.photoutil.R$layout
Warning:com.kosalgeek.android.photoutil.MainActivity: can't find referenced class com.kosalgeek.android.photoutil.R$id
Warning:com.kosalgeek.android.photoutil.MainActivity: can't find referenced class com.kosalgeek.android.photoutil.R$menu
Warning:com.kosalgeek.android.photoutil.MainActivity: can't find referenced class com.kosalgeek.android.photoutil.R
Warning:there were 9 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
Information:BUILD FAILED
Information:Total time: 1 mins 31.858 secs
我的libs文件夹中有photoutil.jar文件,但再次出现相同的错误
请帮我解决这个问题,谢谢
这是我的毕业证书
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.example.jijoabraham.informe"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
maven {
url "http://dl.bintray.com/lukaville/maven"
}
maven { url "https://jitpack.io" }
}
}
configurations{
all*.exclude group: 'com.mcxiaoke.volley'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/PhotoUtil.jar')
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:palette-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.yqritc:recyclerview-flexibledivider:1.2.4'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.nbsp:library:1.09'
compile 'com.github.PhilJay:MPAndroidChart:v2.0.9'
compile 'com.google.firebase:firebase-database:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.pkmmte.view:circularimageview:1.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
请帮我解决这个问题,谢谢提前在你的梯度中添加这个
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/maven/pom.properties'
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'
}
}
在proguard rules.pro中添加
-dontwarn com.kosalgeek.android.photoutil.**
并将true设置为minifyEnabled true
也许这会有帮助 正如我所见,您在发布版本中启用了proguard,因此使用pruguard收到警告是非常常见的
在您的例子中,这些与lib com.kosalgeek.android.photoutil相关。
我认为你应该像上面德文德拉建议的那样使用-dontwarn
如果这不起作用,那么您可能应该为您的库找到正确的proguard规则。请清理项目并再次尝试清理几次,但没有得到任何更改。请帮助meremove jar并清理并重新添加jar,然后再次清理。请发布您的梯度。很可能您没有包括对的依赖性com.kosalgeek.android.photoutil
library。右键单击jar文件,在列表底部,单击以添加为库