简体   繁体   中英

Proguard warning “Can't find referenced class packagename.R$string ” with gradle 3.3.0

Proguard fails with warning after updating gradle plugin to '3.3.2'. The warning is: "Can't find referenced class packagename.R$string "

it's working fine with gradle plugin '3.2+'

The issue might be because of(As per behavioural changes of 3.3):

Faster R class generation for library projects: Previously, the Android Gradle plugin would generate an R.java file for each of your project's dependencies and then compile those R classes alongside your app's other classes. The plugin now generates a JAR containing your app's compiled R class directly, without first building intermediate R.java classes. This optimization may significantly improve build performance for projects that include many library subprojects and dependencies, and improve the indexing speed in Android Studio.

apply below codes to your gradle.properties file.

# Disables R8 for Android Library modules only.
android.enableR8.libraries = false

# Disables R8 for all modules.
android.enableR8 = false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM