Closed sridhard closed 2 years ago
Hi @sridhard đź‘‹ Can you try these proguard rules and try building your application again ?
-dontobfuscate
​# React Native
​-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
​-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
​# Do not strip any method/class that is annotated with @DoNotStrip
​-keep @com.facebook.proguard.annotations.DoNotStrip class *
​-keepclassmembers class * {
​    @com.facebook.proguard.annotations.DoNotStrip *;
​}
​-keep @com.facebook.proguard.annotations.DoNotStripAny class * {
​    *;
​}
​-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
​  void set*(***);
​  *** get*();
​}
​-keep class * implements com.facebook.react.bridge.JavaScriptModule { *; }
​-keep class * implements com.facebook.react.bridge.NativeModule { *; }
​-keepclassmembers,includedescriptorclasses class * { native <methods>; }
​-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
​-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
​-dontwarn com.facebook.react.**
​-keep,includedescriptorclasses class com.facebook.react.bridge.** { *; }
​-keep,includedescriptorclasses class com.facebook.react.turbomodule.core.** { *; }
​# hermes
​-keep class com.facebook.jni.** { *; }
​# okio
​-keep class sun.misc.Unsafe { *; }
​-dontwarn java.nio.file.*
​-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
​-dontwarn okio.**
-dontobfuscate
​# React Native ​-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip ​-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
​# Do not strip any method/class that is annotated with @DoNotStrip ​-keep @com.facebook.proguard.annotations.DoNotStrip class ​-keepclassmembers class  { ​    @com.facebook.proguard.annotations.DoNotStrip *; ​}
​-keep @com.facebook.proguard.annotations.DoNotStripAny class  { ​    ; ​}
​-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class  { ​  void set(); ​   get*(); ​}
​-keep class  implements com.facebook.react.bridge.JavaScriptModule { ; } ​-keep class  implements com.facebook.react.bridge.NativeModule { ; } ​-keepclassmembers,includedescriptorclasses class  { nativeÂ
; } ​-keepclassmembers class   { @com.facebook.react.uimanager.annotations.ReactPropÂ; } ​-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } ​-dontwarn com.facebook.react. ​-keep,includedescriptorclasses class com.facebook.react.bridge. { *; } ​-keep,includedescriptorclasses class com.facebook.react.turbomodule.core.* { ; }
​# hermes ​-keep class com.facebook.jni.* { ; }
​# okio
​-keep class sun.misc.Unsafe { ; } ​-dontwarn java.nio.file. ​-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement ​-dontwarn okio.**
got this error
> Task :app:minifyReleaseWithR8 FAILED
ERROR:/Users/diko/Documents/RN/android/app/proguard-rules.pro:17:1: R8: Expected char '-' at /Users/diko/Documents/RN/android/app/proguard-rules.pro:17:1
​# React Native
^
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:minifyReleaseWithR8'.
> com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: offset: 597, line: 17, column: 1, origin: /Users/diko/Documents/RN/android/app/proguard-rules.pro
just remove # React Native
line
just remove
# React Native
line
i've remove all # but still error at the same line
> Task :app:minifyReleaseWithR8 FAILED
ERROR:/Users/diko/Documents/QNP/talented-mobile-react-native/android/app/proguard-rules.pro:17:1: R8: Expected char '-' at /Users/diko/Documents/QNP/talented-mobile-react-native/android/app/proguard-rules.pro:17:1
​-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
^
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
remove ,
after -keep
Description
Hi,
I am getting the below error when new architecture is eanbled;
ERROR:/Users/**/projects/code/universal-app/learny/react-app/node_modules/react-native/ReactAndroid/build/intermediates/runtime_library_classes_jar/release/classes.jar: R8: Type com.facebook.fbreact.specs.NativeDevLoadingViewSpec is defined multiple times: /Users/**/projects/code/universal-app/learny/react-app/node_modules/react-native/ReactAndroid/build/intermediates/runtime_library_classes_jar/release/classes.jar:com/facebook/fbreact/specs/NativeDevLoadingViewSpec.class, /Users/**/projects/code/universal-app/learny/react-app/android/app/build/intermediates/javac/release/classes/com/facebook/fbreact/specs/NativeDevLoadingViewSpec.class
FAILURE: Build failed with an exception.
I have tried by adding the below rules in proguard. But still it fails -keep class com.facebook.fbreact.specs. {;} -keep class com.facebook.fbreact.specs.* {;} -keep class com.facebook.* { ; }
Version
0.68.1
Output of
npx react-native info
System: OS: macOS 11.2.2 CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz Memory: 84.72 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm Watchman: Not Found Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 Android SDK: API Levels: 23, 25, 26, 27, 28, 29, 30, 31, 32 Build Tools: 23.0.1, 23.0.2, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.0.0 System Images: android-30 | Google APIs Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.6953283 Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild Languages: Java: 15.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.1 => 0.68.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Enable new architecture and compile code
Snack, code example, screenshot, or link to a repository
No response