我已經從我的應用程式中提取了APK,但是現在當我嘗試從應用程式中提取時,它給出了這個錯誤。盡管沒有將任何庫添加到應用程式中,但仍然如此。
錯誤資訊:
任務“:app:javaPreCompileRelease”執行失敗。無法決議配置“:app:releaseAnnotationProcessorClasspath”的所有檔案。找不到 support-annotations.jar (com.android.support:support-annotations:25.3.0)。在以下位置搜索: https ://dl.google.com/dl/android/maven2/com/android/support/support-annotations/25.3.0/support-annotations-25.3.0.jar
可能的解決方案:
- 宣告提供工件的存盤庫,請參閱https://docs.gradle.org/current/userguide/declaring_repositories.html上的檔案
構建.gradle
buildscript {
repositories {
google()
//noinspection JcenterRepositoryObsolete
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
//noinspection JcenterRepositoryObsolete
jcenter()
google()
maven {
url 'https://maven.google.com'
}
maven {
url "https://repository.aspose.com/repo/" }
maven { url 'https://jitpack.io' }
maven { url "https://maven.neshan.org/artifactory/public-maven" }
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "12.0.1"
}
}
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle-wrapper.properties
#Mon Jul 20 12:03:01 IRDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
代碼中沒有進行任何更改,我們只是想獲得另一個輸出。
一般來說,谷歌做這些事情的原因是什么,撰寫和輸出的程式在一段時間后會出現這樣的錯誤,我們必須對程式進行更改,以便它可以輸出 apk。
uj5u.com熱心網友回復:
更新你gradle-wrapper.properties的
#Wed Nov 20 09:57:01 EST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
更新您的 gradle 版本并將 jcenter 替換為 mavenCenter()
buildscript {
repositories {
google()
maven { url "https://jitpack.io" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
google()
maven {
url 'https://maven.google.com'
}
maven {
url "https://repository.aspose.com/repo/" }
maven { url 'https://jitpack.io' }
maven { url "https://maven.neshan.org/artifactory/public-maven" }
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "12.0.1"
}
}
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
- 構建/清理專案
- 同步你的 gradle
- 使快取無效并重新啟動
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/503845.html
上一篇:'com.gorylenko.GenerateGitPropertiesTask'屬性'gitProperties'缺少輸入或輸出注釋?
