Open mnayef95 opened 5 years ago
cc @SidharthGuglani, looks like a compatibility issue in Yoga with R8 enabled, any idea about how to fix it?
Hi guys, I hope this helps you as well as it helped me:
-keep @com.facebook.proguard.annotations.DoNotStrip class * { *; }
I put this on proguard-rules.pro
and it worked!
I am facing a similar issue; @matheusribeirozup's solution (above) did not fix the issue. It said com.facebook.proguard.annotations.DoNotStrip
was an Unresolved class name
.
def litho_version = '0.40.0'
// Reactive UI - Litho
api "com.facebook.litho:litho-core:$litho_version"
api "com.facebook.litho:litho-widget:$litho_version"
kapt "com.facebook.litho:litho-processor:$litho_version"
// SoLoader - Litho
api 'com.facebook.soloader:soloader:0.10.1'
implementation 'com.facebook.fbjni:fbjni:0.2.2'
// For testing Litho
testImplementation "com.facebook.litho:litho-testing:$litho_version"
// Sections - Litho
api "com.facebook.litho:litho-sections-core:$litho_version"
api "com.facebook.litho:litho-sections-widget:$litho_version"
compileOnly "com.facebook.litho:litho-sections-annotations:$litho_version"
kapt "com.facebook.litho:litho-sections-processor:$litho_version"
Any thoughts?
Coming back to this in case someone finds it useful.
My IDE:
Android Studio 4.2.2
Build #AI-202.7660.26.42.7486908, built on June 23, 2021
Runtime version: 11.0.8+10-b944.6916264 x86_64
VM: OpenJDK 64-Bit Server VM by N/A
macOS 10.16
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: com.facebook.litho.intellij, com.github.dhaval2404.material_icon_generator, com.intellij.marketplace, com.thoughtworks.gauge, Dart, org.jetbrains.kotlin, zielu.gittoolbox, io.flutter, de.mariushoefler.flutter_enhancement_suite
My Litho dependencies:
def litho_version = '0.40.0'
// Reactive UI - Litho
api "com.facebook.litho:litho-core:$litho_version"
api "com.facebook.litho:litho-widget:$litho_version"
kapt "com.facebook.litho:litho-processor:$litho_version"
// SoLoader - Litho
api 'com.facebook.soloader:soloader:0.10.1'
implementation 'com.facebook.fbjni:fbjni:0.2.2'
// For testing Litho
testImplementation "com.facebook.litho:litho-testing:$litho_version"
// Sections - Litho
api "com.facebook.litho:litho-sections-core:$litho_version"
api "com.facebook.litho:litho-sections-widget:$litho_version"
compileOnly "com.facebook.litho:litho-sections-annotations:$litho_version"
kapt "com.facebook.litho:litho-sections-processor:$litho_version"
My project layout: root |- :app |- :sdui <--- This was the module that was having issues. |- ... others.
My scenario when I encountered this issue:
The solution (as I understand it, in layman's terms):
minifyEnabled true
in your build.gradle
means R8 is going to strip out any native symbols that the minifier believes aren't being used. In our situation, since our data models were not being referenced anywhere that the compiler could tell, it removed our sdui code, and most of the native library methods that Litho required to operate.
-keep
statements to our consumer-rules.pro
in the :sdui
module so the :app
module could consume them:
-keep class com.facebook.** { *; }
-keep class <pkg>.sdui.** { *; }
res/raw/keep.xml
file to the :sdui
module with the following contents so we could reference drawable
s by name:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:shrinkMode="safe"
tools:keep="@drawable/*"/>
This may not be the most optimal solution, but the app now runs and renders our dynamically generated UI on a minifyEnabled
release build, and we're continuing to optimize it. I hope this info helps someone else down the line.
Version
Issues and Steps to Reproduce
Expected Behavior
The app should be working fine
Actual Behavior