google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

SceneForm 1.7 seems to be missing some Proguard config #533

Open kenyee opened 5 years ago

kenyee commented 5 years ago

Switched to 1.7 and I see this while doing a release build now:


error   15-Feb-2019 15:29:59    Warning: com.google.ar.sceneform.SceneView: can't find referenced class com.google.ar.sceneform.animation.AnimationEngine
error   15-Feb-2019 15:29:59    Warning: com.google.ar.sceneform.SceneView: can't find referenced class com.google.ar.sceneform.animation.AnimationEngine
error   15-Feb-2019 15:29:59    Warning: com.google.ar.sceneform.SceneView: can't find referenced class com.google.ar.sceneform.animation.AnimationEngine
error   15-Feb-2019 15:29:59    Warning: com.google.ar.sceneform.SceneView: can't find referenced class com.google.ar.sceneform.animation.AnimationEngine
error   15-Feb-2019 15:29:59    Warning: com.google.ar.sceneform.SceneView: can't find referenced class com.google.ar.sceneform.animation.AnimationLibraryLoader
error   15-Feb-2019 15:29:59    Warning: com.google.ar.sceneform.SceneView: can't find referenced class com.google.ar.sceneform.animation.AnimationLibraryLoader
error   15-Feb-2019 15:29:59    Warning: com.google.ar.sceneform.SceneView: can't find referenced class com.google.ar.sceneform.animation.AnimationEngine
kenyee commented 5 years ago

FYI, adding these to your proguard file for arcore seems to work:

-dontwarn com.google.ar.sceneform.animation.AnimationEngine
-dontwarn com.google.ar.sceneform.animation.AnimationLibraryLoader

I looked for those classes in this repo as well as in the arcore one and couldn't find anything, so no idea where those classes live :-P Might be a work in progress (I noticed in the announcement that animating 3D models is only supported for the Android Unity SDK?)...

littleylv commented 5 years ago

I got the same error with you.

Task :app:transformClassesAndResourcesWithProguardForDebug FAILED

and other can't find referenced class warnings.

fxsalazar commented 5 years ago

@kenyee you didn't have the issue Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.common.io.Files"

kenyee commented 5 years ago

What I put above is what was needed to fix it for me...our arcore proguard is fairly large though...I had to lift the one that the chrome folks use for sceneform 1.6:

# Keep ARCore public-facing classes
-keepparameternames
-renamesourcefileattribute SourceFile
# These are part of the Java <-> native interfaces for ARCore.
-keepclasseswithmembernames,includedescriptorclasses class com.google.ar.** {
    native <methods>;
}
-keep public class com.google.ar.core.** {*;}
-keep class com.google.ar.core.annotations.UsedByNative
-keep @com.google.ar.core.annotations.UsedByNative class *
-keepclassmembers class * {
    @com.google.ar.core.annotations.UsedByNative *;
}
-keep class com.google.ar.core.annotations.UsedByReflection
-keep @com.google.ar.core.annotations.UsedByReflection class *
-keepclassmembers class * {
    @com.google.ar.core.annotations.UsedByReflection *;
}
# Keep Dynamite classes
# .aidl file will be proguarded, we should keep all Aidls.
-keep class com.google.vr.dynamite.client.IObjectWrapper { *; }
-keep class com.google.vr.dynamite.client.ILoadedInstanceCreator { *; }
-keep class com.google.vr.dynamite.client.INativeLibraryLoader { *; }
# Keep annotation files and the file got annotated.
-keep class com.google.vr.dynamite.client.UsedByNative
-keep @com.google.vr.dynamite.client.UsedByNative class *
-keepclassmembers class * {
    @com.google.vr.dynamite.client.UsedByNative *;
}
-keep class com.google.vr.dynamite.client.UsedByReflection
-keep @com.google.vr.dynamite.client.UsedByReflection class *
-keepclassmembers class * {
    @com.google.vr.dynamite.client.UsedByReflection *;
}
-dontwarn com.google.ar.sceneform.animation.AnimationEngine
-dontwarn com.google.ar.sceneform.animation.AnimationLibraryLoader
DennisBauer commented 5 years ago

Starting from Sceneform 1.10 I get even more warnings:

Warning: com.google.ar.sceneform.rendering.EngineInstance: can't find referenced class com.google.ar.sceneform.assets.Loader
Warning: com.google.ar.sceneform.utilities.SceneformBufferUtils: can't find referenced class com.google.devtools.build.android.desugar.runtime.ThrowableExtension

I can reproduce this also in the hellosceneform example when setting minifyEnabled truein the build.gradle.

I can add another two ignores but I don't think this should be the long term solution:

-dontwarn com.google.ar.sceneform.assets.Loader
-dontwarn com.google.devtools.build.android.desugar.runtime.ThrowableExtension

Is this planned to be fixed in one of the next versions?