R8 和 Proguard 规则
R8 and Proguard Rules
我在我的 android 项目中使用 https://github.com/amalChandran/trail-android
这个库。动画效果非常好。但是,启用 R8 后,动画不工作了。图书馆没有任何 Proguard
建议。我在我的方法之一中添加了以下块,
googleMap.setOnMapLoadedCallback(() -> {
Route normalOverlayPolyline = new Route.Builder(mRouteOverlayView)
.setRouteType(RouteType.PATH)
.setCameraPosition(mMap.getCameraPosition())
.setProjection(mMap.getProjection())
.setLatLngs(mRoute)
.setBottomLayerColor(Color.YELLOW)
.setTopLayerColor(Color.RED)
.create();
map.setOnCameraMoveListener(() -> mRouteOverlayView.onCameraMove(map.getProjection(), map.getCameraPosition()));
我定义了两个全局变量,
public Route route;
public RouteOverlayView mRouteOverlayView;
现在,我的 usage.txt
中有一些详细信息
public void onCameramove(com.google.android.gms.maps.GoogleMap,com.obhai.polyline.trail.RouteOverlayView)
有什么办法可以在proguard-rules.pro
中写点东西,让R8不去掉这部分吗?
感谢@sgjesse 的提示。我终于得到了缩小混淆规则以保持我的功能正常运行。
-keep class com.amalbit.trail.AnimationRouteHelper { *;}
添加此规则符合我的目的。
我在我的 android 项目中使用 https://github.com/amalChandran/trail-android
这个库。动画效果非常好。但是,启用 R8 后,动画不工作了。图书馆没有任何 Proguard
建议。我在我的方法之一中添加了以下块,
googleMap.setOnMapLoadedCallback(() -> {
Route normalOverlayPolyline = new Route.Builder(mRouteOverlayView)
.setRouteType(RouteType.PATH)
.setCameraPosition(mMap.getCameraPosition())
.setProjection(mMap.getProjection())
.setLatLngs(mRoute)
.setBottomLayerColor(Color.YELLOW)
.setTopLayerColor(Color.RED)
.create();
map.setOnCameraMoveListener(() -> mRouteOverlayView.onCameraMove(map.getProjection(), map.getCameraPosition()));
我定义了两个全局变量,
public Route route;
public RouteOverlayView mRouteOverlayView;
现在,我的 usage.txt
中有一些详细信息public void onCameramove(com.google.android.gms.maps.GoogleMap,com.obhai.polyline.trail.RouteOverlayView)
有什么办法可以在proguard-rules.pro
中写点东西,让R8不去掉这部分吗?
感谢@sgjesse 的提示。我终于得到了缩小混淆规则以保持我的功能正常运行。
-keep class com.amalbit.trail.AnimationRouteHelper { *;}
添加此规则符合我的目的。