Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem of BonusPack tuto when porting in Android Studio #106

Open
GoogleCodeExporter opened this issue Apr 6, 2015 · 5 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Integration of OSMBonusPack tuto in Android Studio environment


What is the expected output? What do you see instead?
- in Eclipse IDE : no problem
- Android Studio : trouble with RoadManager and OSM API (road is not loaded, 
and waypoints not found ...)
"Error when loading the road"
"Error when loading KML"

see : attached snapshot (I can not attach the project ... too big)

What version of the products are you using (Android SDK, osmdroid,
OSMBonusPack)?
OsmBonusPack 5.1

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 24 Jan 2015 at 9:10

Attachments:

@GoogleCodeExporter
Copy link
Author

Some clues for explanation ?
-> in Android studion, I have included OsmBonusPack as a whole as a library (in 
a Android Studio module) that is declared as dependency of another module that 
integrates OsmBonusPackTuto as a whole.
-> doing this, building is Ok but I get failures when OsmBonusPack classes 
tries to connect to internet : so this is a clue ->  something may be wrong 
with permission.
-> on internet, I found a thread indicating that in Android Studio, each module 
has its own Manifest
-> so, I have added INTERNET permission to the Manifest attached to the 
OmsBonusPack module, but result is the same :-( ...

/////////////////////////
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.osmdroid.bonuspack"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="11" />

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
////////////////////////

Anybody has an idea ?

Original comment by [email protected] on 25 Jan 2015 at 10:31

@GoogleCodeExporter
Copy link
Author

New trials : if i use directly osmbonuspack as a lib in my Android studio 
Project, i get the same problem as with osmbonuspack as a library module. So 
the problem comes from the way to use the library and how to give it adequate 
internet permissions.... 
No idea ?

Original comment by [email protected] on 26 Jan 2015 at 10:32

@GoogleCodeExporter
Copy link
Author

Nobody has a solution ???

Original comment by [email protected] on 31 Jan 2015 at 6:17

@GoogleCodeExporter
Copy link
Author

I've not tried Android Studio yet. 

1) Have you carefully read the "Important note about network calls" in 
Tutorial_0?

2) If you have to set a Manifest and permissions inside OSMBonusPack lib (which 
sounds really strange), then you certainly have to do the same on osmdroid lib. 

Original comment by [email protected] on 31 Jan 2015 at 5:49

@GoogleCodeExporter
Copy link
Author

You were right Mathieu !

After reading 1) i deviced to downgrade sdk version.

In Android studio, build.gradle file is the place where you put such 
information. Manifest.xlm can still indicate but is not taken into account 
(there are still some parameters to place in manifest , i have to check).

So i modified  targetSdkVersion value in build.gradle file (see copy below) : 9 
is ok but over 10 does not work.

You will see in build.gradle that i use .jar version of osmbonuspack (5.1) 
placed in libs folder.


////////
apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.example.osmbonuspacktuto"
        minSdkVersion 7
        targetSdkVersion 9
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
compile project(':aFileChooser')
//compile project(':OSMBonusPack')
    compile fileTree(dir: 'libs', include: ['*.jar'])
}
//////////////////

Original comment by [email protected] on 1 Feb 2015 at 7:03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant