How to start OsmAnd through Android studio

577 views
Skip to first unread message

ArunBalakrishna

unread,
Dec 10, 2017, 8:58:01 AM12/10/17
to Osmand
Hi,

I had compiled OsmAnd successfully using the article


Compilation is successful.

After importing the gradle project to android studio , i dont know how to follow the step

"You can run OsmExtractionUI.class and it is OsmAndMapCreator"

I am not finding this classes to run for my android studio.

If i select the OsmAnd project and press the run button , then application closes with following error

"OSM and core API sample 1 for android OS has stopped"

it would be great is someone help me with this.
I am not able to find a working solution for this by searching in the net.

Thanks & Regards,
Arun

Andrew Davie

unread,
Dec 10, 2017, 9:12:11 AM12/10/17
to Osmand
I did go through the pain of getting a compile/run workflow going some time back. I wrote down the steps. Not quite your problem, but maybe it will help…
Cheers
A

--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arun Krishna

unread,
Dec 10, 2017, 5:09:54 PM12/10/17
to osm...@googlegroups.com
Hi,

Thank you for the reply.
I had now followed the same steps, except that JDK version is 1.8, so that its compatible with the gradle version.

I still have the same issue.
One other observation is that once the emulator is started, i am not seeing "OsmAnd" but only seeing "OsmAndCore" in the application list in the selected device.
Application is not self launching too.
Could you please let me know this indicate anything wrong with my set up?
(But i selected "OsmAnd" only for running )

Thanks & Regards,
Arun


To unsubscribe from this group and stop receiving emails from it, send an email to osmand+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Osmand" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/osmand/bQiGteHza7o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to osmand+unsubscribe@googlegroups.com.

Arun Krishna

unread,
Dec 11, 2017, 4:07:50 PM12/11/17
to osm...@googlegroups.com
Hi,

When the application launches the following errors are triggered
Executing tasks: [:OsmAnd:assembleFreedevLegacyFatDebug]

10:02 PM Gradle build finished with 101 error(s) and 1 warning(s) in 2m 5s 651ms

Error:(33, 34) error: incompatible types: Application cannot be converted to OsmandApplication
F:\INSTALATIONS\AndroidSDK\Examples\OsmAnd_New\Osmand\OsmAnd\src\net\osmand\plus\AppInitializer.java
Error:(144, 19) error: cannot find symbol method getSharedPreferences(String,int)
Error:(256, 64) error: incompatible types: Application cannot be converted to OsmandApplication
Error:(332, 17) error: cannot find symbol method getString(Integer)
Error:(351, 80) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(355, 18) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(364, 67) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(390, 16) error: cannot find symbol method getString(int)
Error:(392, 16) error: cannot find symbol method getString(int)
Error:(394, 16) error: cannot find symbol method getString(int)
Error:(396, 16) error: cannot find symbol method getString(int)
Error:(398, 16) error: cannot find symbol method getString(int)
Error:(400, 16) error: cannot find symbol method getString(int)
Error:(402, 16) error: cannot find symbol method getString(int)
Error:(404, 16) error: cannot find symbol method getString(int)
Error:(453, 77) error: cannot find symbol method getString(int)
Error:(454, 8) error: cannot find symbol method getString(int)
Error:(555, 45) error: cannot find symbol method getSystemService(String)
Error:(567, 19) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(568, 50) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(594, 18) error: cannot find symbol method getString(int)
Error:(632, 21) error: cannot find symbol method getString(int)
Error:(636, 18) error: cannot find symbol method getString(int)
Error:(778, 25) error: cannot find symbol method getPackageName()
F:\INSTALATIONS\AndroidSDK\Examples\OsmAnd_New\Osmand\OsmAnd\src\net\osmand\plus\OsmandApplication.java
Error:(17, 32) error: package android.support.multidex does not exist
Error:(18, 32) error: package android.support.multidex does not exist
Error:(76, 40) error: cannot find symbol class MultiDexApplication
Error:(130, 2) error: method does not override or implement a method from a supertype
Error:(142, 3) error: cannot find symbol variable super
Error:(180, 2) error: method does not override or implement a method from a supertype
Error:(182, 3) error: cannot find symbol variable super
Error:(183, 3) error: cannot find symbol variable MultiDex
Error:(195, 13) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(211, 2) error: method does not override or implement a method from a supertype
Error:(213, 3) error: cannot find symbol variable super
Error:(309, 2) error: method does not override or implement a method from a supertype
Error:(311, 3) error: cannot find symbol variable super
Error:(315, 2) error: method does not override or implement a method from a supertype
Error:(318, 4) error: cannot find symbol variable super
Error:(323, 67) error: cannot find symbol method getBaseContext()
Error:(323, 4) error: cannot find symbol method getBaseContext()
Error:(326, 4) error: cannot find symbol variable super
Error:(331, 26) error: cannot find symbol method getBaseContext()
Error:(349, 64) error: cannot find symbol method getBaseContext()
Error:(349, 4) error: cannot find symbol method getBaseContext()
Error:(354, 64) error: cannot find symbol method getBaseContext()
Error:(354, 4) error: cannot find symbol method getBaseContext()
Error:(516, 3) error: cannot find symbol method startActivity(Intent)
Error:(527, 33) error: no suitable constructor found for Intent(OsmandApplication,Class<NavigationService>)
constructor Intent.Intent(String,Uri) is not applicable
(argument mismatch; OsmandApplication cannot be converted to String)
constructor Intent.Intent(Context,Class<?>) is not applicable
(argument mismatch; OsmandApplication cannot be converted to Context)
Error:(528, 4) error: cannot find symbol method stopService(Intent)
Error:(565, 61) error: cannot find symbol method getBaseContext()
Error:(566, 39) error: cannot find symbol method getBaseContext()
Error:(583, 60) error: cannot find symbol method getPackageName()
Error:(583, 25) error: cannot find symbol method getPackageManager()
Error:(601, 40) error: cannot find symbol method getSystemService(String)
Error:(631, 44) error: cannot find symbol method getString(int,Object[])
Error:(640, 10) error: no suitable method found for makeText(OsmandApplication,String,int)
method Toast.makeText(Context,CharSequence,int) is not applicable
(argument mismatch; OsmandApplication cannot be converted to Context)
method Toast.makeText(Context,int,int) is not applicable
(argument mismatch; OsmandApplication cannot be converted to Context)
Error:(649, 44) error: cannot find symbol method getString(int,Object[])
Error:(658, 10) error: no suitable method found for makeText(OsmandApplication,String,int)
method Toast.makeText(Context,CharSequence,int) is not applicable
(argument mismatch; OsmandApplication cannot be converted to Context)
method Toast.makeText(Context,int,int) is not applicable
(argument mismatch; OsmandApplication cannot be converted to Context)
Error:(743, 65) error: cannot find symbol method getBaseContext()
Error:(743, 5) error: cannot find symbol method getBaseContext()
Error:(782, 34) error: cannot find symbol method getSystemService(String)
Error:(787, 58) error: cannot find symbol method getPackageName()
Error:(787, 23) error: cannot find symbol method getPackageManager()
Error:(796, 58) error: cannot find symbol method getPackageName()
Error:(796, 23) error: cannot find symbol method getPackageManager()
Error:(805, 32) error: no suitable constructor found for Intent(OsmandApplication,Class<NavigationService>)
constructor Intent.Intent(String,Uri) is not applicable
(argument mismatch; OsmandApplication cannot be converted to String)
constructor Intent.Intent(Context,Class<?>) is not applicable
(argument mismatch; OsmandApplication cannot be converted to Context)
Error:(815, 3) error: cannot find symbol method startService(Intent)
Error:(825, 12) error: cannot find symbol method getString(Integer)
F:\INSTALATIONS\AndroidSDK\Examples\OsmAnd_New\Osmand\OsmAnd\src\net\osmand\plus\GPXUtilities.java
Error:(1197, 14) error: cannot find symbol method getString(int)
Error:(1273, 14) error: cannot find symbol method getString(int)
Error:(1276, 14) error: cannot find symbol method getString(int)
F:\INSTALATIONS\AndroidSDK\Examples\OsmAnd_New\Osmand\OsmAnd\src\net\osmand\plus\GeocodingLookupService.java
Error:(175, 21) error: cannot find symbol method getString(int)
F:\INSTALATIONS\AndroidSDK\Examples\OsmAnd_New\Osmand\OsmAnd\src\net\osmand\plus\TargetPointsHelper.java
Error:(174, 78) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(196, 63) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(217, 69) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(511, 67) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(546, 67) error: incompatible types: OsmandApplication cannot be converted to Context
F:\INSTALATIONS\AndroidSDK\Examples\OsmAnd_New\Osmand\OsmAnd\src\net\osmand\plus\routing\RouteProvider.java
Error:(794, 50) error: cannot find symbol method getString(int)
Error:(796, 50) error: cannot find symbol method getString(int)
Error:(798, 50) error: cannot find symbol method getString(int,String)
Error:(833, 94) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(1080, 25) error: cannot find symbol method getString(int,String)
Error:(1082, 20) error: cannot find symbol method getString(int,String)
Error:(1087, 20) error: cannot find symbol method getString(int,String)
Error:(1208, 34) error: no suitable method found for loadGPXFile(OsmandApplication,ByteArrayInputStream)
method GPXUtilities.loadGPXFile(Context,File) is not applicable
(argument mismatch; OsmandApplication cannot be converted to Context)
method GPXUtilities.loadGPXFile(Context,InputStream) is not applicable
(argument mismatch; OsmandApplication cannot be converted to Context)
F:\INSTALATIONS\AndroidSDK\Examples\OsmAnd_New\Osmand\OsmAnd\src\net\osmand\plus\OsmandSettings.java
Error:(260, 55) error: cannot find symbol method getSystemService(String)
Error:(270, 55) error: cannot find symbol method getSystemService(String)
Error:(1518, 13) error: cannot find symbol method getFilesDir()
Error:(1523, 25) error: cannot find symbol method getExternalFilesDirs(<null>)
Error:(1533, 13) error: cannot find symbol method getNoBackupFilesDir()
Error:(1549, 25) error: cannot find symbol method getExternalFilesDirs(<null>)
Error:(1556, 25) error: cannot find symbol method getObbDirs()
Error:(1624, 26) error: cannot find symbol method getExternalFilesDirs(<null>)
Error:(2447, 77) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(2459, 78) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(2059, 77) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(2081, 78) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(2207, 77) error: incompatible types: OsmandApplication cannot be converted to Context
Error:(2233, 78) error: incompatible types: OsmandApplication cannot be converted to Context
Error:Execution failed for task ':OsmAnd:compileFreedevLegacyFatDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED in 2m 5s

Could anyone please let me know the root caues.

Thanks & Regards,
Arun

Arun Krishna

unread,
Dec 11, 2017, 5:02:49 PM12/11/17
to osm...@googlegroups.com
Adding to the previous comments "OsmAnd-freedev-legacy-fat-debug" is already created in the build folder

Arun Krishna

unread,
Dec 11, 2017, 5:47:03 PM12/11/17
to osm...@googlegroups.com
Hi,

I found the build logs are not cleared properly.
So i had done Invalidate Caches/Restart and then the build logs are proper.
Now from command line the build is successful.
But the gradle build in android has the following error
:OsmAnd:mergeFreedevLegacyFatDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':OsmAnd:mergeFreedevLegacyFatDebugResources'.
> Java heap space

I this this is the reason the application is not starting, its not build through android studio, even though compilation is success through command line.
I am debugging further to get some hint on this.
It would be great is anyone has some hint regarding this, since i am new to android studio.

Thanks & Regards,
Arun

Arun Krishna

unread,
Dec 12, 2017, 7:07:31 PM12/12/17
to osm...@googlegroups.com
Hi,

Today i tried directly running the OsmAnd on my android device, selecting this device instead of emulator in android studio , and it works.

Only when i select the emulator in android studio, gradle build trigger again and gives error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':OsmAnd:mergeFreeLegacyFatDebugResources'.
> Java heap space


* Get more help at https://help.gradle.org

Thanks & Regards,
Arun
Reply all
Reply to author
Forward
0 new messages