MichaelRocks / paranoid

String obfuscator for Android applications.
Apache License 2.0
670 stars 79 forks source link

Unable to find method 'kotlin.text.StringsKt.chunked(Ljava/lang/CharSequence;I)Ljava/util/List;' #35

Closed Mukeshkrjha closed 3 years ago

Mukeshkrjha commented 3 years ago

Hi,

While running or building project I getting below error: Unable to find method 'kotlin.text.StringsKt.chunked(Ljava/lang/CharSequence;I)Ljava/util/List;'. 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.

My Project Gradle is below:

buildscript { repositories { google() jcenter() maven {url 'https://maven.fabric.io/public'} mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.google.gms:google-services:4.0.0' classpath 'io.fabric.tools:gradle:1.25.4' // classpath 'net.sf.proguard:proguard-gradle:6.2.2' classpath 'io.michaelrocks:paranoid-gradle-plugin:0.3.2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

// configurations.all { // resolutionStrategy { // force 'net.sf.proguard:proguard-base:6.0' // } // } }

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

task clean(type: Delete) { delete rootProject.buildDir }

Module Gradle is below:

apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'io.michaelrocks.paranoid'

android { compileSdkVersion 28 buildToolsVersion "28.0.3" defaultConfig { applicationId "mukesh.test.app" minSdkVersion 16 targetSdkVersion 28 versionCode 17 versionName "1.1.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true } buildTypes { debug { minifyEnabled false shrinkResources false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' buildConfigField "boolean", "enableDebugLogging", "true" buildConfigField "boolean", "enableExceptionLogging", "false" /ext.enableCrashlytics = false/ } release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' buildConfigField "boolean", "enableDebugLogging", "false" buildConfigField "boolean", "enableExceptionLogging", "false" } } lintOptions { checkReleaseBuilds true abortOnError false } }

dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) implementation 'com.android.support:appcompat-v7:28.1.1' //compile 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.volley:volley:1.1.0' implementation 'com.android.support:design:28.1.1' implementation 'com.android.support:support-v4:28.1.1' implementation 'com.android.support:recyclerview-v7:28.1.1' implementation 'com.android.support:cardview-v7:28.1.1' implementation 'uk.co.chrisjenx:calligraphy:2.3.0' implementation 'com.github.bumptech.glide:glide:3.5.2' implementation 'com.squareup.retrofit2:converter-gson:2.5.0' implementation 'com.squareup.okio:okio:2.1.0' implementation 'com.squareup.retrofit2:retrofit:2.5.0' implementation 'com.squareup.okhttp3:okhttp:3.12.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1' implementation 'de.greenrobot:eventbus:3.0.0-beta1' implementation 'com.github.d-max:spots-dialog:0.7@aar' implementation 'com.google.firebase:firebase-core:16.0.3' implementation 'com.google.firebase:firebase-analytics:16.0.3' implementation 'com.google.firebase:firebase-messaging:17.1.0' implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5' implementation 'com.android.support:customtabs:28.1.1' implementation 'pub.devrel:easypermissions:1.0.1' implementation 'com.facebook.android:facebook-android-sdk:[4,5)' //implementation 'com.google.android.gms:play-services-vision:11.8.0' implementation 'com.google.android.gms:play-services-vision:15.0.2' implementation 'com.datatheorem.android.trustkit:trustkit:1.1.2' // implementation 'androidx.preference:preference:1.1.1' testImplementation 'junit:junit:4.12' }

configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '26.1.0' } } } }

apply plugin: 'com.google.gms.google-services'

Thanks, Mukesh

giacomoferretti commented 3 years ago

Are you using Kotlin? If yes I don't see any Kotlin dependecies in your Gradle files.

See this on how to add that: https://developer.android.com/kotlin/add-kotlin

Also please place all of your code inside a code block, you can use three backticks for multiline text.

MichaelRocks commented 3 years ago

Hi @Mukeshkrjha,

I saw similar crashes happening because of using a legacy Gradle and/or Android plugin. Because of some reasons I'm not aware of, Gradle plugins that require a newer version of Kotlin may have an older version on the classpath. As far as I understand it happens because this older version is embedded into Gradle. So if you update Gradle and Android plugin everything should work fine.

Mukeshkrjha commented 3 years ago

@giacomoferretti I'm not using kotlin.

Mukeshkrjha commented 3 years ago

Hi @MichaelRocks,

You are correct.

Issue was due to old Kotlin version in old gradle version. So I have upgraded both Android Gradle plugin to: classpath 'com.android.tools.build:gradle:3.5.3' Gradle version to: distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

You have set Kotlin version for this library 1.3.61. Above Gradle plugin have Kotlin version 1.3.51 and its working now.