Graphhopper not working in release apk

I have developed an android application using the graphhopper
routing library. The library works fine in debug mode or in
app-debug.apk but when I create a release apk of the app the library
wont work. It is giving me java.lang.IllegalStateException: No input stream found in class path!? exception upon execution of the following code.

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

While creating the release apk i got some warning for the graphhopper library and removed the warnings using
-dontwarn com.graphhopper.**
in the file.
Is there any issue with creating a release apk of the graphhopper project?

Why wont the library work in release version of the apk?

I dont see any other posts regarding this kind of issue.

TranslationMap.doImport uses TranslationMap.class.getResourceAsStream and with ProGuard obfuscation may be the reason.

You can exclude GraphHopper in ProGuard with:
-keep class com.graphhopper.** { *; }


Nice to hear from you again @devemux86. :slight_smile:

Your solution worked fine. Thnx.

Also as i was tinkering around to find a solution, i set minifyEnabled false
in build.gradle. Which also worked but it made my app size much larger.

That would disable ProGuard altogether.

And using ProGuard in release apks is highly recommended.

1 Like

Yes. That would.
Your solution seems to be working perfectly fine now.

And finally we have released the application.
Thank you. Highly appreciated your immediate response.

I was in a hurry to get the app released so if it was up to me, i would have released without the proguard. :stuck_out_tongue: