The app I am developing works perfectly on my emulator, but it won't work on my phone when I try to debug it. I only get the message:
Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse
Restart ADB integration and try again.
Waiting for process: com.deliciouslymad.tsukasa.critterbytes
It hangs there forever with no change on my phone. It doesn't work after restarting or cleaning the project, either. I've tried many solutions on this site already, but none of them have resolved this issue.
-UPDATE-
ADB logs:
ddms: null
java.lang.NullPointerException
at com.android.ddmlib.Client.sendAndConsume(Client.java:673)
at com.android.ddmlib.HandleHello.sendHELO(HandleHello.java:195)
at com.android.ddmlib.HandleHello.sendHelloCommands(HandleHello.java:66)
at com.android.ddmlib.Client.getJdwpPacket(Client.java:772)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:317)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)
The .apk installs on my phone just fine.
I have 'USB debugging', 'allow mock locations', and 'verify apps over USB' turned on in my phone settings. Runtime is Dalvik and it's connected as a media device.
My phone runs Android 4.4.4.
If it helps, I am implementing the Zxing library into my code for barcode scanning.
Here's my AndroidManifest.xml code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.deliciouslymad.tsukasa.critterbytes">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity android:name="ScannerActivity"
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>
Here's my build.gradle code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.deliciouslymad.tsukasa.critterbytes"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.0'
}
Additionally, in my app's project structure, the 'Compile Sdk Version' is API 21 and the 'Build Tools Version' is 21.1.2. 'Source Compatibility' and 'Target Compatibility' are blank, and I'm not sure if anything is supposed to be there.
The gradle builds fine with no errors, but there is something strange; when I hover over 'getDefaultProguardFile' in the build.gradle file, it says that it cannot resolve the symbol.
I am a junior programmer and trying to learn, so please let me know if there's anything missing or anything I can improve! This is all a little overwhelming and I can't figure out why it's not working.
Related
I was following this tutorial from youtube to learn to make an android keyboard. I followed everything as described in it. I was able to build the project succesfully but whenever I try to run it I was getting the following error -
Instant Run performed a full build and install since the installation on the device does not match the local build on disk
So I googled for a solution and tried turning off Instant Run, then the above mentioned error was not appearing. The APK was installed to my device, but when I tried to enable the keyboard in the settings it was not found there. I tried it in device and 2 emulators, but problem is same everywhere.
I don't know what to do. I will copy my Android Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tomsapp.keeskeyboard">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<service
android:name=".KeesKeyboard"
android:label="#string/app_name"
android:permission="android:permission.BIND_INPUT_METHOD">
<meta-data android:name="android.view.im" android:resource="#xml/method"/>
<intent-filter>
<action android:name="android.view.InputMethod"/>
</intent-filter>
</service>
</application>
and Build Gradle file here:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.tomsapp.keeskeyboard"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Please point out what I am doing wrong here.
In your build.Gradle file set minSDK to 22n so it matches your android vertual device.
If there is an image view in your app then place that image Corresponding to image view in the drawable folder. Don't keep it in drawable -v24 folder and run on your device it may work
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.
Although I have been searching on Stack Overflow for quite some time, did not find the answer I want so far.
1. Problem description:
I have an Android app with bunch of activities and submitted to
Google Play. After it's published, I downloaded it, whenever open the
app, it starts a new task. I need to click the hardware back button
several times to kill all the tasks. While, after that, whenever I
launch the app again, everything is fine.
Another weird thing is
that there's no problem if I directly install the app on the device
through adb command (adb install xxxx.apk)
2. What I did:
originally, in the code, I was using the "standard" launch mode for the launch activity. I encountered the problem as described above.
after I read the official document, I realized that "standard" mode will launch an instance of the activity everytime, so I changed the launch mode to be "singtop", but the problem is still there.
3. What I do not understand:
Why the app keeps creating new task if I install the app from Google Play. Why "Singtop" launch mode does not work in this case?
why I do not have the problem when install the app directly through adb command, while I get the problem when install app from Google Play. What's the difference.
4. Source code for reference:
build.gradle (Module:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.testing.exampletesting"
minSdkVersion 17
targetSdkVersion 22
}
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.1.0'
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testing.exampletesting"
android:versionCode="10"
android:versionName="1.0.1" >
<application
android:allowBackup="true"
android:icon="#mipmap/app_logo"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name=".LaunchActivity"
android:launchMode="standard">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DummyAActivity" />
<activity android:name=".DummyBActivity" />
<activity android:name=".DummyCActivity" />
</application>
</manifest>
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
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.