【问题标题】:Graphhopper not working in release apk.Graphhopper 在发行版 apk 中不起作用。
【发布时间】:2016-11-15 11:02:04
【问题描述】:

我使用 graphhopper 路由库开发了一个 android 应用程序。该库在调试模式或 app-debug.apk 中工作正常,但是当我创建应用程序的发布 apk 时,该库将无法工作。它给了我 java.lang.IllegalStateException: No input stream found in class path!? 执行以下代码时出现异常。

/*
*Constants.ROUTE_FILE_PATH = Environment.getExternalStorageDirectory().getPath()+"/.myappfolder/routes";
*/
 File routingFiles = new File(Constants.ROUTE_FILE_PATH);
 GraphHopper tmpHopp = new GraphHopper().forMobile();
 tmpHopp.load(routingFiles.getAbsolutePath());

在创建发布 apk 时,我收到了有关 graphhopper 库的一些警告,并使用删除了警告

-dontwarn com.graphhopper.**

在 proguard-rules.pro 文件中。

创建graphhopper项目的发布apk有什么问题吗? 为什么库不能在 apk 的发布版本中工作?

【问题讨论】:

    标签: java android android-proguard android-studio-2.2 graphhopper


    【解决方案1】:

    好的,所以我找到了这个问题的 2 个答案。

    首先,你可以设置

    minifyEnabled false 
    

    build.gradle 中。这也可以作为一种解决方案,但您的应用不会被缩小。

    其次根据to the answer posted here可以设置

    -keep class com.graphhopper.** { *; }
    

    proguard-rules.pro中。

    所以无论哪个答案最适合你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-07
      • 1970-01-01
      • 1970-01-01
      • 2021-07-17
      • 2020-02-16
      • 1970-01-01
      • 1970-01-01
      • 2021-08-18
      相关资源
      最近更新 更多