My application is having trouble on real devices - android

I have finish my application and run it perfectly on my emulator (Nexus 6 API 22). But when I try to run it on a real device, I have troubles, in the first device (with version 5) I have tried crash when I start an activity that implements google maps. At first I try to solve it by set it my key to the release folder as well as on the debug one, but the keep crashing. I thought was about some permissions or dependencies, but I thing I have everything right.
My build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "jocadoci.soloordena"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.android.support:design:25.0.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.14.2'
compile 'com.android.support:multidex:1.0.1'
}
And the AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jocadoci.soloordena">
<uses-permission
android:name="jocadoci.soloordena.android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="25" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"
android:maxSdkVersion="25" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="25" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="25" />
<uses-permission
android:name="android.permission.INTERNET"
android:maxSdkVersion="25" />
<uses-permission android:name="mypackage.android.permission.MAPS_RECEIVE"
android:maxSdkVersion="25" />
<application
android:allowBackup="true"
android:icon="#mipmap/soloorndenalogo"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:name="android.support.multidex.MultiDexApplication">
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".RegisterActivity" />
<activity android:name=".MapsItaly"/>
<activity android:name=".ListViewCheckboxesActivity"/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".DrawerActivity"
android:label="#string/title_activity_drawer"
android:theme="#style/AppTheme.NoActionBar">
</activity>
</application>
Then I try on another device (this one was with version 4.2.2), in this device just doesn't want to start, crashed when you tried to open it. I tried to change the version on my compileSDKVersion between 24 and 25 but look that is not that the problem. At this moment I don't know what else do, I thought also that was because my application use a google service should be post it already on google play, I did it but also did not work.
I will appreciate anyone who could help me.
Thanks in advance.
P.S: If someone want to try the app is in the store already but looks that only is available in Mexico, but if some one want to try it I could send my app-release.apk
UPDATE
First thanks all of you for give the time to answer. I appreciate.
Thanks to #Windsor answer came to me the doubt about using the same API key for the debug and release file. Looking about my sha-1 key and on the google development website I realize that indeed I could use the same API key for both files (debug and release) but the think was that with the generated signed key that I create building my apk I could use the sha-1 to add one more restriction to my API key and could use it to the app-release.apk. Successful the app run correctly on a real device (version 5), but unfortunately keep stopped on others version devices.

hello can you cheked Location Permision for API level 23?

Generate a signed apk.
Make sure you have your sha1 release key on Google API services. Does debug work on real devices?
Can't tell you without seeing the main activity.
If you api key isn't working normally you just don't get a map. If it works on multiple android versions in a emulator ods are api key. Debug keys don't work in the final copy you need to generate a apk with the release key!!!
Could be you method for getting location services.
I build for the lowest target version test then add compatibility for newer version that's what I like.

Related

Play Store says "can't install this app try again, and if it still doesn't work, see common ways to fix it" after downloading is 100% complete

Play Store says "can't install this app try again, and if it still doesn't work, see common ways to fix it".
I have published UPDATE of my different android apps on play store and it got successfully live as usual. But the thing is that on my Google Play Console all apps' new install were ZERO from past 2,3 days.
Manifest AND Build Gradle: App are attached.
I WANT TO MENTION THAT THE APPS ARE BEING DOWNLOADED FOR 100%, then the below dialogue is displayed.
Message Shown on Each Apps Installation
Below is manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com...">
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/ime_name"
android:largeHeap="true"
tools:replace="android:icon,android:label">
<activity
android:name="com...Main"
android:screenOrientation="unspecified"
android:label="#string/ime_name"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".PrefActivity"></activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|
screenLayout|uiMode|screenSize|smallestScreenSize" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="#string/ads_application_id"/>
</application>
</manifest>
Build Gradle : App
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-R'
buildToolsVersion '29.0.2'
defaultConfig {
applicationId '...'
minSdkVersion 16
targetSdkVersion 29
versionCode 4
versionName '4.43'
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation 'junit:junit:4.13'
implementation project(':lib')
implementation project(':library')
implementation 'com.google.android.gms:play-services-ads:19.0.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
}
I don't have answers for you, but would like to help you debug this issue. If you have a device that reproduces the problem, try connecting it to your ADB and reading through the error logs what is happening when you get this message. In my case it was something like:
Submitter: commit error message INSTALL_FAILED_UPDATE_INCOMPATIBLE:
Package signatures do not match previously
installed version; ignoring! Task Failed: tid:1000000026,
statusCode:6004
com.google.android.finsky.installerv2.InstallerException: Status: 6004
This made me conclude that there was nothing wrong with the update itself. I was just trying to update from the version that Google Play did not sign to the one signed by Google Play. Not to mention it was a false alarm as my users were not dealing with this issue at all.
Hope you guys find your error message and get to fix your problems!

Signed apk has 0 compatibility in google play store

I've been working on a project for some time now and I pretty much finished and am ready to release it to the play store. I was able to deploy my app through debug mode via the USB cable onto my Samsung s4 phone. Strangely, when I generated the signed apk and released it to the play store, I can't download it on my phone... This makes no sense since I was able to use it when I was testing it... I asked my friends and they experienced the same thing. I looked at my developer console and it says my app is compatible with LITERALLY 0 phones in the market... So I looked it up and I thought maybe my manifest is messed up, so here it is (I'm using android studio btw):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="XXXX">
<uses-permission android:name="android.permission.CAMERA" />
<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_CONTACTS" />
<uses-feature android:name="android.hardware.CAMERA"/>
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:name="android.support.multidex.MultiDexApplication"
>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<activity
android:name="XXXX"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="#string/app_name" />
<provider android:authorities="com.facebook.app.FacebookContentProviderXXXX"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
</application>
</manifest>
So I see no issues in the manifest (maybe someone can correct me on that) and if there were it wouldn't have ran on my phone when I tested the app.
So I use a lot of external libraries for my app, here is the list:
1) facebook api
2) twitter api
3) snapdragon
4) google play service
I also had to use multidex (as you saw in the manifest) because the code exceeded 64k lines of code. Here's how the build.gradle looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "xxxx"
minSdkVersion 16
targetSdkVersion 23
versionCode 3
versionName "1.2"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { java.srcDirs = ['src/main/java', 'libs'] } }
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile('com.twitter.sdk.android:tweet-composer:1.0.2#aar') {
transitive = true;
}
}
I'm totally new with gradle so I'm not sure if it's set up correctly so there maybe issues with the gradle itself or maybe something else. Anyone have any suggestions what I can do?
I changed the camera feature to required false in the manifest and that did the trick. When I uploaded the apk in the developer console it said 8k+ devices supported. Also the manifest was inccorect, when you put the use-features tag make sure to have camera all lowercase not uppercase like I had.

Google Api Key Missing

I am trying to launch an android wearable with an emulator, but it crashes on startup and getting the following error:
 
java.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
But the weird part is i did defined it in my manifest like this:
New editted that "works"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wearfare.wearapp.gpswear"
android:versionCode="1"
android:versionName="1.0" >
<!-- Mark this app as an Android Wear app. -->
<uses-feature android:name="android.hardware.type.watch" />
<!-- Permission required for ambient mode to keep the application running. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault" >
<!-- API key for the Android Maps API v2. The value is defined as a string resource. -->
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="xxxxxxxxxxxxxxx"/>
<!-- Reference the wearable shared library required to support ambient mode. -->
<uses-library android:name="com.google.android.wearable" android:required="false" />
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
EDIT 2
I am getting the following:
10-07 10:04:43.972 1614-1614/com.wearfare.wearapp.gpswear W/ResourcesManager﹕ Asset path '/system/framework/com.google.android.wearable.jar' does not exist or contains no resources.
10-07 10:04:43.993 1614-1631/com.wearfare.wearapp.gpswear I/GMPM﹕ App measurement is starting up
10-07 10:04:43.995 1614-1631/com.wearfare.wearapp.gpswear E/GMPM﹕ getGoogleAppId failed with status: 10
10-07 10:04:43.995 1614-1631/com.wearfare.wearapp.gpswear E/GMPM﹕ Uploading is not possible. App measurement disabled
EDIT build.gradle
apply plugin: 'com.android.application'android {
signingConfigs {
}
compileSdkVersion 22
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.wearfare.wearapp.gpswear"
minSdkVersion 22
targetSdkVersion 23
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.google.android.support:wearable:1.3.0'
provided 'com.google.android.wearable:wearable:1.0.0'
compile 'com.google.android.gms:play-services-wearable:8.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services-maps:8.1.0'
}
xxx is the api key i put in, but still getting the same error message when running the project. any suggestions what i am missing here?
Thanks in advance.
ALMOST THERE
Ok Guys, it looks like it does work, but it doesnt show my map, it's a grey field. I figured out i can dismiss the app when i longpress it.
So maybe it could be something else why it isnt showing my map?
I think the problem of the grey screen is that you didn't obtain the API key correctly. Please ensure that you have obtained the key correctly. I've had this exact problem when my key was generated for release instead of debug mode.
https://developers.google.com/maps/documentation/android-api/start#obtaining_an_api_key
I have checked your manifest and found problem in it.
Please add </manifest> tag at the end of the file.

Can't use Google Play Services on emulator android studio

I can't use Google Play services with the emulators in Android Studio. I give you my build.gradle and manifest files:
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
repositories {
mavenCentral()
}
defaultConfig {
applicationId "fr.myapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
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.1'
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.android.support:multidex:1.0.1'
}
Part of my AndroidManifest (I don't show all the activities):
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/app_id" />
<activity
android:name=".SettingsActivity"
android:label="#string/title_activity_settings" >
</activity>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
</application>
</manifest>
And in a xml I just have the google button : com.google.android.gms.common.SignInButton
And when I lauch my Application, when I arrive in the activity containing the button, I have the following message : "the app won't run unless you update Google Play services". I also have (I tried some solutions) "this app won't run without Google Play services, which are missing from your phone".
I've found some questions on this problem, but it always said that the last emulator don't have this problem. But using the default Nexus 5 (API 22) emulator on android studio gives me these errors. So I tried to install the last apk google play services file, and after successing the install, I launch the app and have this time this error : "the app relies on Google play services, which is not supported by your device. Contact the manufacturer for assistance." I also tried with a virtual device that I created, with API 22 and 23 and I have the same errors.
I don't understand because I thought that the errors with Google play services didn't exist anymore on the last API.
Thanks for help.
Maybe try to create emulator with image x86 which includes Google APIs

Android Wear apk built in Android Studio will not parse when opened on 'phone

I have a simple Android Wear app that runs fine on the Gear Live and in the Emulator, and which I'd now like to package into an .apk for distribution.
I'm using Android Studio but am more familiar with Eclipse for Android development, so may have something wrong.
Here is the build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "myApp"
minSdkVersion 20
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// You must install or update the Support Repository through the SDK manager to use this dependency.
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v13:+'
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
wearApp project(':app')
}
and here is the Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myApp" >
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault" >
<activity
android:name="myApp"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!--
<category android:name="android.intent.category.LAUNCHER" />
-->
</intent-filter>
</activity>
</application>
</manifest>
The gradle build completes without error: I sign the app with the same keys I use for non-wear apps in the Play Store. Whether I open the created apk file on a device running Android 4.4.4, or a device running 4.3 (the 'phone that's actually in communication with the Gear Live), I obtain the error:
"There is a problem parsing the package"
Initially I assumed that this was because the 'phone was running 4.3, whereas the target/min SDK is 20. But I get the same parse error on a 4.4.4 tablet.
Could anyone suggest what I may have wrong?
On the mobile (phone) app your Min SDK should be 18 with target sdk at 20 since your phone is running 18 (4.3) and your tablet is running 19 (4.4).
On your wear app it should be Min SDK 20.
Also just a gotcha I found is you need to sign both the mobile and wear app's which you may hit next.

Categories

Resources