我已将Android Studio更新为3.4。 进行发布版本时出现错误。
usercount
我在gradle中更新了我的依赖项 这是我的gradle文件
Unable to find method
'com.android.tools.r8.Version.getVersionString()Ljava/lang/String;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after
a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping
all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible
with the other plugins in the project or the version of Gradle
requested by the project.
In the case of corrupt Gradle processes, you can also try closing the
IDE and then killing all Java processes.
我不使用Kotlin。 我检查了如下所示的各种资源,但没有用
java.lang.NoSuchMethodError - Ljava/lang/String;)Ljava/lang/String;
也尝试过 重新下载依赖项并同步项目 和 停止Gradle构建过程(需要重新启动) 但没有一个。
项目级gradle文件
dependencies {
//Retrofit networking libraries
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
//Use for converting JsonObject to Plain Text in retrofit
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
//http logging interceptor
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
// For circular progressbar design
implementation 'me.relex:circleindicator:1.2.2@aar'
//Crashlytics library dependency
implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
transitive = true;
}
//ViewModel concept used in
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'android.arch.lifecycle:livedata-core:1.1.1'
//RangeSeekBar Design
implementation 'com.yahoo.mobile.client.android.util.rangeseekbar:rangeseekbar-library:0.1.0'
//Clevertap events
implementation 'com.clevertap.android:clevertap-android-sdk:3.2.0'
//For volley networking library implementation
implementation 'com.android.volley:volley:1.1.0'
//For token passing classes
implementation 'com.auth0.android:jwtdecode:1.1.1'
//Rooted device finding library
implementation 'com.scottyab:rootbeer-lib:0.0.7'
//Facebook integration
implementation 'com.facebook.android:facebook-android-sdk:4.35.0'
//New Relic interation library
implementation 'com.newrelic.agent.android:android-agent:5.9.0'
//Calender library
implementation project(':library')
//Channel level encryption library
implementation files('libs/bcprov-jdk15on-160.jar')
//Injection tool
annotationProcessor 'com.jakewharton:butterknife:6.1.0'
implementation 'com.jakewharton:butterknife:6.1.0'
/*annotationProcessor 'com.jakewharton:butterknife:10.1.0'
implementation 'com.jakewharton:butterknife:10.1.0'*/
//Image Loading library
implementation 'com.github.bumptech.glide:glide:3.7.0'
//Secure SQLite Database
implementation 'net.zetetic:android-database-sqlcipher:3.5.9@aar'
//Branch .io library
implementation('io.branch.sdk.android:library:2.+') {
exclude module: 'answers.shim'
}
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:design:26.0.2'
implementation 'com.google.android.gms:play-services:11.0.1'
implementation 'com.google.android.gms:play-services-maps:11.0.1'
implementation 'com.google.firebase:firebase-core:11.0.1'
implementation 'com.google.firebase:firebase-messaging:11.0.1'
implementation 'com.android.support:support-v4:26.0.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':mpointintegration')
}
答案 0 :(得分:1)
问题是您对R8 1.3.52有固定的版本依赖性:
classpath ('com.android.tools:r8:1.3.52' ) { transitive false }
还有com.android.tools.r8.Version
方法
public String getVersionString()
仅在R8 1.4和更高版本中存在。
由于该版本中的错误修复,我假设您使用的是R8的固定版本。但是,该问题也应该在最新版本中修复,因此我建议您删除固定的R8版本依赖性,并使用Android Studio随附的软件。
答案 1 :(得分:0)
我解决了。从android studio 3.4开始,在android studio中添加了R8版本控制。 所以我在build.gradle文件和gradle.properties文件中做了一些更改
在发布部分的应用程序级别build.gradle文件中,我添加了一行
useProguard false
&在gradle.properties文件中
android.enableR8=true
因此它将使用R8版本创建我的APK。
如果您不想使用R8版本控制并且想继续使用proguard,请进行
android.enableR8=false //in gradle.properties file
希望这会对某人有所帮助