Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proguard warning about AtomicFU#setInterceptor() #1116

Closed
folkyatina opened this issue Apr 18, 2019 · 1 comment
Closed

Proguard warning about AtomicFU#setInterceptor() #1116

folkyatina opened this issue Apr 18, 2019 · 1 comment
Assignees
Labels
Milestone

Comments

@folkyatina
Copy link
Contributor

After updating to 1.2.0 I got

Warning: kotlinx.atomicfu.AtomicFU: can't find referenced method 'void setInterceptor(kotlinx.atomicfu.AtomicOperationInterceptor)' in program class kotlinx.atomicfu.InterceptorKt
from ProGuard, version 6.0.3.

I solved it by adding -dontwarn kotlinx.atomicfu.AtomicFU in proguard rules, but I'm in doubt if it's a safe way to fix it and even if it is. It's probably required to add this line to coroutines.pro file.

@qwwdfsad qwwdfsad added the bug label Apr 19, 2019
@elizarov elizarov added this to the 1.2.1 milestone Apr 19, 2019
@elizarov elizarov self-assigned this Apr 19, 2019
elizarov added a commit that referenced this issue Apr 19, 2019
* Update to atomicfu 0.12.4, which fixes plugin operation with
  kotlin-multiplatform
* Remove explicit dependencies (plugins adds them automatically)

Fixes #1116
elizarov added a commit that referenced this issue Apr 20, 2019
* Update to atomicfu 0.12.4, which fixes plugin operation with
  kotlin-multiplatform
* Remove explicit dependencies (plugins adds them automatically)

Fixes #1116
Fixes #1064
elizarov added a commit that referenced this issue Apr 21, 2019
* Update to atomicfu 0.12.4, which fixes plugin operation with
  kotlin-multiplatform
* Remove explicit dependencies (plugins adds them automatically)

Fixes #1116
Fixes #1064
elizarov added a commit that referenced this issue Apr 22, 2019
This should really fix processing of class files

Fixes #1116
Fixes #1064
elizarov added a commit that referenced this issue Apr 23, 2019
This should really fix processing of class files

Fixes #1116
Fixes #1064
@utkarshGithub
Copy link

utkarshGithub commented May 7, 2019

strill getting warning Warning: kotlinx.coroutines.flow.FlowKt__MergeKt: can't find referenced class kotlinx.atomicfu.AtomicBoolean
cannot make release build :

`buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
configurations.all {
    resolutionStrategy {
        force 'net.sf.proguard:proguard-gradle:6.0.3'
    }
}

}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-kapt'
repositories {
mavenCentral()
google()
maven { url 'https://maven.fabric.io/public' }
maven{ url 'https://sdk.uxcam.com/android/' }
}

//project.ext {
// daggerVersion = "2.13"
// rxJavaVersion = "2.1.0"
// rxAndroidVersion = "2.0.2"
//}
android {
signingConfigs {
config {
keyAlias 'key0'
keyPassword 'qwerty'
storeFile file('/Users/utkarshshukla/Desktop/keystores/android.jks')
storePassword 'qwerty'
}
}
compileSdkVersion 27
defaultConfig {
minSdkVersion 16

    targetSdkVersion 27
    applicationId  "com.gyanapp"
    versionCode 206
    multiDexEnabled true
    vectorDrawables.useSupportLibrary = true
    versionName "1.0.59"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {


        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
        debuggable false
    }
    debug {


        minifyEnabled false
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

// manifestPlaceholders = [applicationId:android.defaultConfig.applicationId + ".dev"]
debuggable true

    }
}
flavorDimensions "default"
productFlavors {
    dev {
        buildConfigField "String", rootProject.ext.SERVER_URL, rootProject.ext.DEV_URL
        buildConfigField "String", rootProject.ext.DYNAMIC_LINK, rootProject.ext.DEV_DYNAMIC_LINK
        applicationId android.defaultConfig.applicationId + ".dev"
        resValue "string", "app_name", "GyanApp-Dev"
        versionName = android.defaultConfig.versionName

// manifestPlaceholders = [applicationId:android.defaultConfig.applicationId +".dev"]

    }
    prod {
        buildConfigField "String", rootProject.ext.SERVER_URL, rootProject.ext.PROD_URL
        buildConfigField "String", rootProject.ext.DYNAMIC_LINK, rootProject.ext.PROD_DYNAMIC_LINK
        applicationId android.defaultConfig.applicationId
        resValue "string", "app_name", "GyanApp"
        versionName = android.defaultConfig.versionName

// manifestPlaceholders = [applicationId:android.defaultConfig.applicationId ]
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
// project.ext {
// daggerVersion = "2.15"
// }
}

dependencies {
implementation project(':gyanapi')
implementation fileTree(include: ['.jar'], dir: 'libs')
implementation project(':aztec')
implementation project(':glide-loader')
implementation project(':picasso-loader')
implementation project(':wordpress-comments')
implementation project(':wordpress-shortcodes')
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(include: ['
.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:$supportLibVersion"
implementation 'org.apmem.tools:layouts:1.10@aar'
implementation 'joda-time:joda-time:2.9.4'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support:design:28.0.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

// Dagger core
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
implementation "com.google.dagger:dagger:$daggerVersion"

// Dagger Android
annotationProcessor "com.google.dagger:dagger-android-processor:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion"

// if you are not using support library, include this instead
implementation "com.google.dagger:dagger-android:$daggerVersion"

kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
// Lifecyles, LiveData and ViewModel
implementation 'android.arch.lifecycle:runtime:1.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
kapt 'android.arch.lifecycle:extensions:1.1.1'

annotationProcessor "android.arch.lifecycle:compiler:1.1.1"

// ReactiveX
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation 'com.squareup.retrofit2:retrofit:2.4.0'

// Retrofit2  converter
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

// Retrofit2 and RxJava2
implementation 'io.reactivex.rxjava2:rxjava:2.1.9'

//    RxAndroid adds android specific bindings for RxJava,

// Specifically AndroidSchedulers.mainThread() which provides a Scheduler

// that schedules on main thread and can be used to switch between threads in Android.
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'

//    Retrofit 2 works seamlessly with RxJava 2 using the

// RxJava 2 adapter for Retrofit 2, add the following dependency

// to enable the RxJava 2 compatibility
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
    transitive = true;
}
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.facebook.android:facebook-android-sdk:4.37.0'
implementation 'org.parceler:parceler-api:1.1.11'
annotationProcessor 'org.parceler:parceler:1.1.11'
implementation 'org.jsoup:jsoup:1.10.3'
implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
implementation 'com.github.duanhong169:colorpicker:1.1.5'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.6.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.wordpress:utils:$wordpressUtilsVersion"
implementation 'com.mixpanel.android:mixpanel-android:5.+'
implementation 'com.google.android.gms:play-services-gcm:16.1.0'
implementation 'com.google.firebase:firebase-dynamic-links:16.1.8'
implementation "com.google.firebase:firebase-invites:16.1.1"
implementation 'com.google.firebase:firebase-perf:16.2.5'
implementation 'com.android.installreferrer:installreferrer:1.0'
implementation "android.arch.work:work-runtime:$work_version" // use -ktx for Kotlin+Coroutines

// optional - RxJava2 support
implementation "android.arch.work:work-rxjava2:$work_version"

// optional - Test helpers
androidTestImplementation "android.arch.work:work-testing:$work_version"

// implementation 'com.appsee:appsee-android:+'
implementation 'com.uxcam:uxcam:3.0.6@aar'
implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:3.0.3'
implementation 'com.airbnb.android:lottie:2.6.0'

implementation 'com.clevertap.android:clevertap-android-sdk:3.4.2'

implementation 'com.google.android.exoplayer:exoplayer:2.8.4'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.8.4'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.8.4'

// Room components
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
kapt "android.arch.persistence.room:compiler:$rootProject.roomVersion"
androidTestImplementation "android.arch.persistence.room:testing:$rootProject.roomVersion"

// Lifecycle components
kapt "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"

// Coroutines
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines"

implementation 'com.facebook.stetho:stetho:1.5.1'

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

kotlin {
experimental {
coroutines "enable"
}
}`

### proguard rules

`
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}

-keep class com.google.gson.** { ; }
-dontwarn com.squareup.picasso.
*
-dontwarn com.squareup.okhttp.**
-keep public class org.jsoup.** { public *; }

-dontwarn com.google.errorprone.annotations.**

-keepclassmembers class * implements java.io.Serializable {
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}

-keepnames class com.facebook.FacebookActivity
-keepnames class com.facebook.CustomTabActivity

-keep class com.facebook.login.Login

-keepattributes Signature, InnerClasses
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* ;
}
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn javax.annotation.**
-dontwarn kotlin.Unit
-dontwarn retrofit2.-KotlinExtensions
-dontwarn okio.**

-keepattributes Annotation

-keepclassmembers enum android.arch.lifecycle.Lifecycle$Event {
;
}

-keep class * implements android.arch.lifecycle.LifecycleObserver {
}

-keep class * implements android.arch.lifecycle.GeneratedAdapter {
(...);
}

-keepclassmembers class ** {
@android.arch.lifecycle.OnLifecycleEvent *;
}

-keep class com.crashlytics.** { ; }
-dontwarn com.crashlytics.
*

-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}

-keep interface org.parceler.Parcel
-keep @org.parceler.Parcel class * { *; }
-keep class **$$Parcelable { *; }

-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}

-keepattributes SourceFile,LineNumberTable

-keep class org.apache.** { ; }
-keepnames class com.fasterxml.jackson.
* { ; }
-keepnames class javax.servlet.
* { ; }
-keepnames class org.ietf.jgss.
* { ; }
-dontwarn org.w3c.dom.
*
-dontwarn org.joda.time.**
-dontwarn org.shaded.apache.**
-dontwarn org.ietf.jgss.**

-keep class com.shaded.fasterxml.jackson.** { *; }

-dontwarn kotlin.**

-keep public class com.google.android.gms.* { public ; }
-dontwarn com.google.android.gms.
*

-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}

-dontwarn org.conscrypt.**

-dontwarn com.google.gson.Gson$6

-keep class com.appsee.** { ; }
-dontwarn com.appsee.
*
-keep class android.support.** { ; }
-keep interface android.support.
* { ; }
-keep class androidx.
* { ; }
-keep interface androidx.
* { ; }
-keep class com.uxcam.
* { ; }
-dontwarn com.uxcam.
*

-dontwarn com.clevertap.android.sdk.**

-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}

-keepclassmembernames class kotlinx.** {
volatile ;
}

-keep class com.google.android.gms.internal.** { *; }
-dontwarn com.google.android.gms.internal.zzhu

-dontwarn kotlin.**
-dontwarn kotlin.reflect.jvm.internal.**
-keep class kotlin.reflect.jvm.internal.** { *; }

-keep class kotlin.Metadata { ; }
-keepclassmembers public class com.mypackage.
* {
public synthetic ;
}
-keepclassmembers class kotlin.Metadata {
public ;
}

-keepclassmembers class **$WhenMappings {
;
}

-dontwarn android.arch.util.paging.CountedDataSource
-dontwarn android.arch.persistence.room.paging.LimitOffsetDataSource

-keep class com.facebook.stetho.** { ; }
-dontwarn com.facebook.stetho.
*
-dontwarn kotlinx.atomicfu.AtomicFU`

project build.gradle

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

buildscript {
ext {
gradlePluginVersion = '3.1.3'
kotlinVersion = '1.3.30'
supportLibVersion = '27.1.1'
tagSoupVersion = '1.2.1'
glideVersion = '3.7.0'
picassoVersion = '2.5.2'
robolectricVersion = '3.5.1'
jUnitVersion = '4.12'
jSoupVersion = '1.10.3'
wordpressUtilsVersion = '1.21'
espressoVersion = '3.0.1'
daggerVersion = "2.15"
rxJavaVersion = "2.1.0"
rxAndroidVersion = "2.0.2"
work_version="1.0.0-beta01"
SERVER_URL = "SERVER_URL"
PROD_URL = '"https://gyanapp.in/"'
DEV_URL = '"https://ssr.gyanapp.in/"'
DEV_DYNAMIC_LINK = '"https://gyanappdev.page.link"'
PROD_DYNAMIC_LINK = '"https://gyan.page.link"'
DYNAMIC_LINK = "DYNAMIC_LINK"
roomVersion = '1.1.1'
archLifecycleVersion = '1.1.1'
coroutines = '1.2.1'
}
ext.kotlin_version = '1.3.21'

repositories {
    google()
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
    classpath 'com.google.gms:google-services:4.2.0'
    classpath 'com.google.firebase:firebase-plugins:1.2.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    classpath 'com.appsee:appsee-plugin:+'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    // 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-gradle:6.0.3'
    }
}

}

allprojects {
repositories {
google()
jcenter()
}
}

subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "27.1.1"
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants