According to the doc: Packing wearable Apps I am using the following code:
dependencies
{
compile 'com.google.android.gms:play-services:5.0.+#aar'
compile 'com.android.support:support-v4:20.0.+''
wearApp project(':wearable')
}
I have generated the release version using the Generate Signed APK. The first time when I install the apk the android wear app is installed properly things are working as required.
I uninstall the app from my mobile. The android wear app also gets uninstalled without any issues, but if I install the app again in my mobile, I don't see the app in the android wear. I am not sure why this is happening. I have tried the same with different apps that that are compatible with android wear those work fine. Install and uninstall and install again, I can see them on android wear emulator.
Here is the build.gradle file from my Application folder:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.ysk.notes"
minSdkVersion 9
targetSdkVersion 20
versionCode 3
versionName "1.02"
}
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':FacebookSDK')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
compile 'com.google.android.gms:play-services:5.0.+#aar'
compile 'com.android.support:support-v4:20.0.+'
wearApp project(':Wearable')
configurations
{
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
Can somebody let me know where I am going wrong?
I had this problem where the wear app wouldn't install. So I made sure the mobile app was installed (after exporting singed APK and doing an ADB INSTALL), then opened the Android Wear app, pressed the gears icon at the top and then selected Resync apps.
I have two suggestions for you that may help.
1) You mention you're using the wear emulator instead of a real watch device. I have experienced issues with connecting and syncing the emulator. Try resetting the emulator and reconnecting through Android Wear on your phone (aka running adb -d forward tcp:5601 tcp:5601) again.
2) There seems to be some caching of versionCode on the Phone and it uses that to know if it needs to resync and update the app on the watch. Try incrementing your versionCode and see if that helps.
Hope one of those helps.
Try unpair and restore factory rest .
It will solve the problems and sync all the data.
It worked for me
Related
I'm using IntelliJ Idea Community Edition 2017.2.5 and am building an Android app.
My problem is that even if in my app (Gradle) I have:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.0"
defaultConfig {
applicationId "com.app.mtvtr"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support:design:27.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.android.support:support-v4:27.0.0'
testCompile 'junit:junit:4.12'
}
Also, on first build of the project, compile for the appcompat, design and support was set to 27+ (which IMHO is bad practice and is already pointed by the Studio as a bad idea), so using which tools that I have, I have set it to 27.0.1, and later to 27.0.0 just for the testing if it might work..
In my Fragments and Activities I have:
And the warning says:
The sdk platform-tools version (26.0.2) is too old to check APIs
compiled with API 27; please update
Now, I know that there are topics on SO regarding old and new versions, but I have (to my belief) set the Gradle properly and I am nowhere using platform-tools version 26 or even 26.0.2...
I have tried Restarting and invalidating caches three times.
The project properly builds onto the device and everything works. But, of course, I want to fix the warning. (And not hide it like some would suggest..)
Two things that come to mind are:
I missed somewhere that I should have updated the version, maybe?
I need to start a new project from scratch.
Any ideas? :)
Android Studio 3.0 will be merged into IntelliJ IDEA 2017.3 version, which will make the com.android.tools.build:gradle:3.0.0 plugin compatible with it. That will make this error to go away.
For those of you who are experiencing this issue in Android Studio, check your root build.gradle file and make sure it is updated to the above mentioned plugin version (3.0.0), in order to be able to compile against API 27 with the current latest build tools (26.0.2).
You may consequently also have to update the Gradle wrapper to the latest (4.1 at the time of this answer).
You have just to launch the SDK Manager and download the Android SDK Platform Tools and SDK Tools.
Here the official doc.
It seems that it was an IDE problem because it worked without warnings inside Android Studio 3.0 as it was suggested by CrazyCoder.
It seems that at this moment IntelliJ Idea isn't updated enough to make this work properly. So even while I have been using Idea from the start, I will switch to AS for now. :)
Thanks for your input guys. :)
I am new to android development,
i have made one app which is working perfect on 5.0 and above. but when i tasted .apk with my other phone which is runnnig on micromax 4.4.2 os( 480x800) mobile, it installs but doesnt open. unfortunately app_name has been stop.
so i attatchd my microamx mobile to android studio and tried to run app. everything workd well. why it doesnt work when i shared .apk before??
please help.
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.kalpu.practice1234"
minSdkVersion 14
targetSdkVersion 24
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:24.1.1'
}
This issue is caused by Instant Run. It is not the problem of gradle.
Instant Run will generate the .apk for a specific device and if you use the same .apk for another device it will not work.
If you want to run the same .apk on another device then disable Instant Run and build.
Try below things:
Turn off Instant run from android studio like below.
Then clean project and rebuild it.
Then Run it.
If still you getting problem then post your logcat error.
I wouldn't turn off a useful feature (Instant run)
Generating the signed version just for this can be overkill, especially if it's a new project that hasn't been signed yet.
Simply use the Build APK menu item from the Build menu.
You will get a small popup with a link to open the generated APK in the file manager:
Note: the screenshots are taken in Android Studio 2.2 running in Windows 10.
I can't get my Android Wear app to work. Every time it tries to open something on the phone I keep getting this error in the logcat:
W/GooglePlayServicesUtil: Google Play services out of date. Requires 9256000 but found 8701534
Nothing should be wrong with my application, because it worked before. It stopped working when I did a factory reset on my LG G Watch.
I checked the Google Play version codes on the watch with an app, and it is (as the logcat tells) 8701534. (Why isn't it updating?) My phone has the version code 9256448. Here are some screenshots:
(Click for larger screenshots).
Here is the (shortened) build.gradle of the watch:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.my.packagename"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:1.3.0'
compile 'com.google.android.gms:play-services-wearable:9.2.0'
}
And here is the (shortened) build.gradle of the phone:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.my.packagename"
minSdkVersion 11
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services-wearable:9.2.0'
...
}
I have already tried the usual things like:
Factory reset on the watch (About 5 times already)
Cleared cache/data of Google Play services on the phone
Reinstalled Google Play Services on the phone.
Connected the watch to 3 different devices. See below for device names.
Leave the watch connected for about 12 hours. (Both phone and watch connected and on the charger). Nothing changed.
Changed compile 'com.google.android.gms:play-services-wearable:9.2.0' to compile 'com.google.android.gms:play-services-wearable:+'
Here are the phone models I tried on including the watch:
LG G Watch LGW100 (Android 6.0.1, Android Wear 1.5)
Huawei Nexus 6P (Android Nougat Preview 4)
Samsung Galaxy S5 (Android 6.0.1)
Samsung Galaxy S6 (Android 6.0.1)
I'm sure it isn't the phone because I had the watch connected on three different devices.
Do you have any suggestions?
I had the same problem today and somehow I managed to overcome it. Things I did:
reinstalled Android Wear on the phone (due to this)
unpaired the watch from the Android Wear app, then repaired it
resynced apps from the Android Wear app a couple of times
on the watch, in Settings/About/Versions, I tapped the GMS version a couple of times. It should say 'Checking for updates'. At first there were errors in logcat at this operation, then (after reinstalling, etc.) these disappeared.
started Maps and Fit (hoping that they somehow trigger the update)
It finally updated. It took a few days for it to update Google Play services. Now it has version 9.2.56. I guess it just takes some time for the watch to update Google Play services.
You can edit the dependency version:
compile 'com.google.android.gms:play-services-wearable:8.7.0'
Notice 8.7 instead of 9.2. Also please note that this isnt a fix, its a workaround.
Edit: In a perfect world, all watches will instantaneously update to the latest play services, but that doesnt seem to be the case yet. This is also why I declared this as a workaround rather than a fix.
Another option is to manually upgrade Google Play services via odb:
download latest Google Play services apk (from here)
install it via adb install -r com.google.android.gms*
My watches (Samsung Gear S with Wear 1.5) had extremely old version of Google Play services after factory reset (same as yours: 8.7.01 - 534) and did not install any application after pairing. Manually updating play services solved that.
Whenever I run my app in my emulator, which uses the Google maps API, I get the error "App wont run unless you update google play services". I've digged through some other questions about the same topic here on SO, since there are many, but I did not find a solution yet. So how do I get the Google maps API to work on my emulator?
When I go through installed apps on the emlator I don't see Google Play services in the list. So I am guessing this is the problem? If so, how do I get this on my device? Or isn't it possible at all on an emulator to use Google Play services?
I am using an emulator with Google API enabled.
Here is my Gradle build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.thomas.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:design:23.0.1'
}
I had this same problem. I opened my emulator, went to Settings -> Apps -> Google Play services, and noted the version (in my case, 8.1.65). Then I opened my build.gradle and saw that the version there for com.google.android.gms:play-services was 8.3.0. I changed it to 8.1.0 and it worked on the emulator.
You might have to do a check in your code if the user has Google play services installed. If they dont, prompt them to download it from the play store.
So There was no way to make Google play services run the default Android emulator shipped with the SDK . So instead I started to look into other emulators and found xamarin android player. I got Google play store and Google play services working on it in no time. So if anyone also has this issue, use this emulator instead. The only downside is you can't debug in it.
I got around this limitation of Android emulators by using Samsung's Device Test Lab - http://developer.samsung.com/remotetestlab. You can launch from a multitude of devices there, which all have Play Services.
I'm learning Android Studio, and this error keeps popping up.
(on Emulators)
pkg: /data/local/tmp/com.test.sunshine
Failure [INSTALL_FAILED_UID_CHANGED]
and this
(on Physical Device)
pkg: /data/local/tmp/com.test.sunshine
Failure [INSTALL_FAILED_DEXOPT]
It will prompt to uninstall but nothing happens because the app is not yet installed.
This is the first time I have run any projects on Android Studio. I have Genymotion emulators running and also tried it on my physical device, still with the same results.
I tried transferring the apk to the emulator and installing it from there. Still the same error comes up
I haven't touched any code, this is the precoded Blank Activity with Fragment.
I have the latest Android Studio 1.0 as well as the latest SDKs.
I searched through many questions here and they all suggest to remove the app directly with root. I cant because, the app is not installed. I tried to clean then rebuild, still the same.
I'm beggining to suspect its on the gradle Scritps. I'm new to Android Studio so i dont know any of the workings of gradle.
Here is my gradle script:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.marlon.sunshine"
minSdkVersion 14
targetSdkVersion 21
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:21.0.2'
}
EDIT
Ok so for anyone still looking into this problem, I haven't found any solution to this, the error just disappeared when I updated Android Studio. So the latest updates of the IDE must have made a solution.