Невозможно найти метод 'com.android.tools.r8.Version.getVersionString () Ljava / lang / String;' - PullRequest
1 голос
/ 21 мая 2019

Я обновил свою андроид студию до 3.4. Я получаю сообщение об ошибке при сборке релиза.

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.

Я обновил свои зависимости в 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')

}

Я не использую kotlin. Я проверил различные ресурсы, как показано ниже, но ни один не работал

java.lang.NoSuchMethodError - Ljava / lang / String;) Ljava / lang / String;

Android Studio 3.0 - не удается найти метод 'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs () Ljava / util / List'

также пробовал с Повторно загрузите зависимости и синхронизируйте проект & Остановить процессы сборки Gradle (требуется перезагрузка) но никто не работал.

Файл проекта уровня gradle Файл

// Top-level build file where you can add configuration options common 
to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
    mavenCentral()
    google()
    maven { url "http://storage.googleapis.com/r8-releases/raw"}
}
dependencies {
    classpath ('com.android.tools:r8:1.3.52' ) { transitive false }
    classpath 'com.android.tools.build:gradle:3.4.0'
    classpath 'com.google.gms:google-services:4.2.0'
    classpath "com.newrelic.agent.android:agent-gradle-plugin:5.9.0"
    // NOTE: Do not place your application dependencies here; they 
belong
    // in the individual module build.gradle files
}
}


allprojects {
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com'
    }

   // maven { url 'https://jitpack.io' }
    google()
}
}
ext {
 minSdkVersion = 15
 targetSdkVersion = 26
 compileSdkVersion = 26
 buildToolsVersion = '26.0.2'
 sourceCompatibilityVersion = JavaVersion.VERSION_1_8
 targetCompatibilityVersion = JavaVersion.VERSION_1_8
 }
 task clean(type: Delete) {
 delete rootProject.buildDir
 }
 ext.deps = [
    // Test dependencies
    junit      : 'junit:junit:4.10',
    festandroid: 'com.squareup:fest-android:1.0.7',
    robolectric: 'org.robolectric:robolectric:2.2',
    intellijannotations: 'com.intellij:annotations:12.0'
 ]

Ответы [ 2 ]

1 голос
/ 21 мая 2019

Проблема в том, что у вас есть фиксированная версия зависимости от 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.

0 голосов
/ 22 мая 2019

Я решил это.С Android Studio 3.4 версии R8 добавлен в Android Studio.Поэтому я сделал некоторые изменения в своем файле build.gradle и файле gradle.properties

В своем файле build.gradle уровня приложения в разделе выпуска я добавил одну строку

useProguard false

& в gradle.файл свойств

android.enableR8=true

, поэтому для создания моего APK будет использоваться управление версиями R8.

Если, если вы не хотите использовать управление версиями R8 и хотите продолжить с Proguard, наберите

 android.enableR8=false //in gradle.properties file

Надеюсь, это кому-нибудь поможет

...