Google Maps api2 with Android Studio issue - android

Using Eclipse I converted several Google Maps v1 to v2 without many problems. One of my services uses the V1 GeoPoint class a great deal and I was able to use the code unaltered by importing import com.google.android.maps.GeoPoint. I have a half dozen apps running maps V2 with using this GeoPoint class.
Now I'm over on Android Studio converting my last maps V1 app to maps V2 but even though I have the same import statement I'm getting an exception at at run time when I reference the GeoPoint class. Saying...
NoClassDefFoundError: Failed resolution of: Lcom/google/android/maps/GeoPoint.
So the same code runs fine when testing in Eclipse but blows when testing in Android Studio.
EDIT: The GeoPoint class compiles fine in AS it just blows at run time. I don't know what would cause this.
If it helps I include my manifest file and the module Build.gradle.
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:21'
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.deanblakely.mttTrial"
minSdkVersion 10
targetSdkVersion 21
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':library')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.google.code.gson:gson:2.2.2'
compile 'com.google.android.gms:play-services:+'
}
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.deanblakely.mttTrial"
android:versionCode="22"
android:versionName="2.22" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="21" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<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_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:xlargeScreens="true" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="com.deanblakely.mttTrial.PSActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar" >
</activity>
<activity
android:label="#string/app_name"
android:name="com.deanblakely.mttTrial.LicenseCheck"
android:theme="#android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<uses-library android:name="com.google.android.maps" />
</activity>
<service
android:name="com.deanblakely.mttTrial.StalkService"
android:exported="false" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="not the actual key" />
<!--' Release key is not the actual release key'-->
<!--' Debug key is not the actual debug key'-->
</application>
<!-- Required permission to check licensing. -->
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
</manifest>

Improve your build.gradle
compile 'com.google.android.gms:play-services:5.0.89'
And add this your Manifest
<uses-permission android:name="com.deanblakely.mttTrial.permission.MAPS_RECEIVE" />

Related

Supported Android Devices = zero

My app can't be found when someone looks for it from their google play app on their Android phone. (shows find when searched from browser). This is because Google Play says my app supports "0 devices".
The support chat person at Google play says this is the reason:
"Your app is not compatible with certain devices due to a conflict in your app’s manifest with the following: no supported native platform:
armeabi, armeabi-v7a, and missing device features: android.hardware.faketouch, android.hardware.screen.portrait"
I can't figure out what the heck that means.
My manifest file is as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.deanblakely.SafeTalk"
android:installLocation="preferExternal"
android:versionCode="30"
android:versionName="1.06 " >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="25" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:xlargeScreens="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<!--android:theme="#android:style/Theme.NoTitleBar" -->
<activity android:name="SplashActivity"
android:label="#string/app_name"
android:theme="#style/SplashTheme">
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="MainActivity"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:theme="#style/AppTheme.NoActionBar"
>
</activity>
<receiver
android:name="com.deanblakely.SafeTalk.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.deanblakely.SafeTalk" />
</intent-filter>
</receiver>
<service android:name="com.deanblakely.SafeTalk.GcmIntentService" />
</application>
</manifest>
My gradle file is as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy' //httpClient not supported in 23.
lintOptions { disable 'MissingTranslation' }
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
}
signingConfigs {
releaseConfig {
storeFile file("XXXXXXXXXXXXXXXXX");
storePassword ("XXXXXXXXXX");
keyPassword ("XXXXXXXXXX");
keyAlias "XXXXX
}
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.releaseConfig
}
debug {
debuggable true
applicationIdSuffix ".debug"
}
}
flavorDimensions "stupidDimensionone"
productFlavors {
scFlavor
{
applicationId 'com.deanblakely.SafeTalk.sc'
dimension "stupidDimensionone"
}
safetalkFlavor
{
applicationId "com.deanblakely.SafeTalk"
dimension "stupidDimensionone"
}
}
}
dependencies {
compile project(':dropboxChooserSDK')
compile files('libs/gson-2.2.4.jar')
compile files('libs/microsoft-translator-java-api-0.6.2-jar-with-dependencies.jar')
compile 'com.android.support:appcompat-v7:25+'
compile 'com.android.support:design:25+'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
}
This didn't used to be this way. I suppose it is another breaking change. Anyone know what is causing this?
As usual I am answering my own question . . .
I made the following replacement in my gradle . . .
//compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'commons-io:commons-io:2.6'
I found a post from somebody else that had the same problem. I don't know why it works and neither did the original person with the problem. I think this is either caused by buggy Google Play software and/or a complete lack of documentation.
Usually this problem are about configuration permision or uses feature
In this case looks the problem is like this:
<uses-feature android:name="android.hardware.bluetooth" />
<uses-feature android:name="android.hardware.camera" />
Check the users feature you need to change in the DOCUMENTATION

When I change minSdkVersion 8 to minSdkVersion 9

I had this problem:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [com.google.android.gms:play-services:9.4.0] C:\Users\Esprit\Desktop\Alphabet AdMob\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\9.4.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.play_services" to force usage
But when i change "minSdkVersion 8" to "minSdkVersion 9" I get 255 errors
Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.viavilab.alphabet"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.viavilab.alphabet.Splash_Activity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.viavilab.alphabet.CapitalAlphabet_Activity"
android:configChanges="orientation|keyboardHidden" >
</activity>
<activity
android:name="com.viavilab.alphabet.MainActivity"
android:configChanges="orientation|keyboardHidden" >
</activity>
<activity
android:name="com.viavilab.alphabet.SmallAlphabet_Activity"
android:configChanges="orientation|keyboardHidden" >
</activity>
<activity
android:name="com.viavilab.alphabet.AboutActivity"
android:configChanges="orientation|keyboardHidden" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<!-- Activity required to show ad overlays. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
</manifest>
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:15'
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.viavilab.alphabet"
minSdkVersion 8
targetSdkVersion 18
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.android.gms:play-services:+'
}
As you can read in the official doc about Setting up Google Play Services, the minSdkVersion must be 9. Even they are informing in the release notes, Google Play services 10.0.x is the final release that includes full support for Android version 2.3.x (Gingerbread).
By the way, in your build.gradle file, replace your compileSdkVersion to 18. You are already adding google play services to your app, as you can see in your dependencies.
compileSdkVersion 18
A tip: I think is highly recommendable to set a version to libraries you are using. The plus character in a dependency means you are using the latest version of the library. Every time app is built, you will use the latest version and maybe, your app can be incompatible with it or there are some bugs in the library you don't want to include in your app. So, set the version you want to use. For example,
compile 'com.google.android.gms:play-services:10.0.1'

I'm having white map with Could not find class 'android.app.AppOpsManager'

I've build mapActivity before and it worked perfectly and map appeared... I worked on other project to get a map but it didn't work.... I back to my first mapActivity project(which was working perfectly) and lunched again (after removing its map app from my phone) but it didn't worked and give me blank map
there are the erors:
1-Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.internal.zzro.zzg
2- Could not find class 'android.app.AppOpsManager', referenced from method rv.a
3- Authentication failed. Timeout while trying to contact the server.
and thid in Manifest:
<?xml version="1.0" encoding="utf-8"?>
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<permission
android:name="com.example.asus.myapplicationhello.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="com.example.asus.myapplicationhello.permission.MAPS_RECEIVE"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:largeHeap="true"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
and this is the gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.example.asus.myapplicationhello"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:multidex:1.0.0'
}

This app is incompatible with your device

I have just made an android application tested on "HUAWEI T1-701u" AND "HUAWEI T1-A21L", i have generated a signed apk and it's now published on the play store,
the problem is the app just working on anything i have expect HUAWEI T1-701u even i tested on it, it says something like this: app is not compatible with this device, even i tested on it.
here is the manifest
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<supports-screens android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:requiresSmallestWidthDp="100" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.NoActionBar">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
and here is the gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "org.iowpjordan.mpic"
minSdkVersion 12
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
}
Please note that the screen size of HUAWEI T1-701u is 7 inch and the other one is 10 approximately
Please advice.
Regards.
the features in manifest are too sensitive if do you put a useless feature and you don't have it on your phone then the app will not be compatible with your phone
if you are not using Autofocus,remove this line <uses-feature android:name="android.hardware.camera.autofocus" />
because the phone which are you testing on, doesn't have autofocus feature! that's why the app will not be compatible with your device
You have mentioned targetSdkVersion 19 in build.gradle file.
It will work for only kitkat devices.
What is the android version of the device that you are testing?

SIP API SipManeger returns null

I'm trying to use SIP API in my android application and geting some strange situation. If i'm use VitrualBox device with android 4.2.2 it's work well, but when i'm installing the same app to real devices with the same android version it says that SipManager.newInstance(this) return null and getApiVersion() return false(Testing on Lenovo & GSmart). But when i'm installing another SIP application from play market to device it works well.
I'm trying to find reason, maybe that device firmware some strange but other SIP app works. Can you help to find solution to solve this and get SipManager on device?
Manifest file
<uses-permission android:name="android.permission.USE_SIP" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature
android:name="android.hardware.sip.voip"
android:required="true" />
<uses-feature
android:name="android.hardware.wifi"
android:required="true" />
<uses-feature
android:name="android.hardware.microphone"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".WalkieTalkieActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SipSettings"
android:label="set_preferences" />
<receiver
android:name=".IncomingCallReceiver"
android:label="Call Receiver" />
</application>
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.uniphone.dev3.siptest"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
So, all i find is that (custom)android phone firmware still goes disgusting with SIP and not all devices can run SIP API. And only one case is to use 3d party library on C++.
As final i used JAIN-SIP java library from Oracle.
Examples i found at Mobicents/restcomm-android-sdk

Categories

Resources