R8和Proguard规则

编程入门 行业动态 更新时间:2024-10-14 14:22:08
本文介绍了R8和Proguard规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在我的android项目中正在使用github/amalChandran/trail-android这个库.动画效果非常好.但是,启用R8后,动画无法正常工作.该库没有任何Proguard建议.我在其中一种方法中添加了以下代码块,

I am using github/amalChandran/trail-android this library in my android project. The animation was working perfectly fine. But, after enabling R8, the animation is not working. The library does not have any Proguard suggestion. I added the following block in one of my method,

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()));

在定义了两个全局变量的地方,

Where I have two global variables defined,

public Route route; public RouteOverlayView mRouteOverlayView;

现在,我在Usage.txt中有一些详细信息

Now, I have some details in my usage.txt

public void onCameramove(com.google.android.gms.maps.GoogleMap,com.obhai.polyline.trail.RouteOverlayView)

有什么办法可以在proguard-rules.pro中编写一些东西,以使R8不会删除此部分吗?

Is there any way to write something in proguard-rules.pro so that R8 doesn't remove this part?

推荐答案

感谢@sgjesse的提示.我终于有了缩小的proguard规则,以保持功能正常运行.

Thanks to @sgjesse for his hint. I finally got my narrowed down proguard rule to keep my feature functioning.

-keep class com.amalbit.trail.AnimationRouteHelper { *;}

添加此规则可达到我的目的.

adding this rule served my purpose.

更多推荐

R8和Proguard规则

本文发布于:2023-11-30 17:21:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650873.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:规则   Proguard

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!