I'm developing a watch face. The project consists of watch face and handheld app to report the mobile battery. There is no actual companion app - the app is even hidden from the drawer.
I'm encountering the issue that when I install the app on the phone the face is not syncing on the watch.
I'm compliant with almost everything I've found on the internet:
The apk is generated by Android Studio - release version, signed, the wear app is in the res/raw folder.
Permissions are the same for mobile and wear app.
The dependencies are set correctly.
APK is installed via ADB, Watch app are force synced ...
It is worth mentioning that the mobile app does not have an activity or something. So there is no way to manually start it.
Is there anything I'm missing. From my perspective there is not reason not to work ...
Mobile Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="name.name" >
<uses-sdk android:minSdkVersion="18"
android:targetSdkVersion="21" />
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SET_TIME_ZONE"/>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name" >
<!--android:theme="#style/AppTheme" >-->
<service android:name="name.name.BatteryListener"
android:permission="android.permission.BIND_WALLPAPER" >>
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<meta-data android:name="com.google.android.wearable.beta.app"
android:resource="#xml/wearable_app_desc"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
Mobile Gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile "com.android.support:support-v4:21.0.2"
compile "com.android.support:support-v13:21.0.2"
compile "com.android.support:cardview-v7:21.0.2"
compile "com.google.android.support:wearable:1.1.+"
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "20"
defaultConfig {
applicationId "name.name"
minSdkVersion 18
targetSdkVersion 21
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
Wear Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="qualiss.qualissfacewatch" >
<uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="21" />
<uses-feature android:name="android.hardware.type.watch" />
<!-- Required to act as a custom watch face. -->
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SET_TIME_ZONE"/>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault">
<service
android:name="name.name.MyWatchFace"
android:label="Name"
android:permission="android.permission.BIND_WALLPAPER" >
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="#drawable/preview_square"/>
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="#drawable/preview_circle" />
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.example.android.wearable.watchface.CONFIG_ANALOG" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="name.name.BatteryActivity">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
Wear Gradle:
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
compile 'com.google.android.support:wearable:1.1.+'
compile 'com.google.android.support:wearable:1.1.0'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "20"
defaultConfig {
applicationId "name.name"
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}
}
Both Gradle files were closely matched to Android Watch Face sample ... I was just desperate.
Check that you have identical set of permissions in phone and watch manifest files. It was reason for me in same situation.
You have this in your Wear manifest:
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.example.android.wearable.watchface.CONFIG_ANALOG" />
This looks like it is left over from the example code and is likely pointing to an Activity which does not exist in your mobile app. This could very likely cause a problem with deploying the watch face.
Try removing it and see if it helps.
I've removed those 2 from Wear manifest:
< uses-permission android:name="android.permission.SET_TIME_ZONE"/>
< uses-permission android:name="android.permission.BATTERY_STATS"/>
To me it seems like the correct procedure for permissions should not be to have the same in mobile and wear manifest, but to inherit the wear permissions in mobile and not (also) vice versa.
Thanks for the help!
In your mobile gradle... you need to include this...
dependencies {
wearApp project(':Wearable')
Related
I want to generate APK of the ionic app but I am getting
Program type already present: com.getcapacitor.AndroidProtocolHandler
error while building the ionic 4 app with angular. I have searched this on the internet and find one solution which says change
implementation 'ionic-team:capacitor-android:1+'
to
implementation project(':capacitor-android')"
in dependencies in build.gradle file but I already have implementation project(':capacitor-android')" in my dependency and I'm still getting the error.
This is link to the solution I have tried: https://github.com/oxylian/capacitor-facebook-login/issues/3
This is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "io.ionic.starter"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://dl.bintray.com/ionic-team/capacitor"
}
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation project(':capacitor-android')
// implementation 'ionic-team:capacitor-android:1+'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(':capacitor-cordova-android-plugins')
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
This is my AndroidManifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.ionic.starter">
<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">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:name="io.ionic.starter.MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/custom_url_scheme" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths"></meta-data>
</provider>
</application>
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Camera, Photos, input file -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Geolocation API -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />
<!-- Network API -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Navigator.getUserMedia -->
<!-- Video -->
<uses-permission android:name="android.permission.CAMERA" />
<!-- Audio -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
</manifest>
The problem is the date picker plugin, it has that line that you have mentioned
https://github.com/triniwiz/capacitor-datepicker/blob/master/src/android/capacitor-datepicker/build.gradle#L45
There is a pull request fixing it, but hasn’t been merged
https://github.com/triniwiz/capacitor-datepicker/pull/12
I am attempting to create a standalone Android Wear app for 1.x and 2. I followed the steps on the android developer page, but users say the wear apk isn't automatically installing on their 1.x watch. The mobile app has the same permissions. This is only here to get the wear apk to install. There are no activities on the mobile app.
Do I need to package the wear app in my mobile app? From what I read this shouldn't be done even for 1.x.
Here is a preview of what my apks look like in the developer console:
Mobile Manifest:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<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.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/Theme.Nav">
</application>
Wear Manifest:
<?xml version="1.0" encoding="utf-8"?>
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<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.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<!-- Required for complications to receive complication data and open the provider chooser. -->
<uses-permission android:name="com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA"/>
<application
android:name=".App"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/Theme.Nav">
<uses-library
android:name="com.google.android.wearable"
android:required="false" />
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="true" />
<activity android:name=".ui.activity.SplashActivity"
android:label="#string/app_name"
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>
</activity>
<!-- Main activity for music browsing on phone -->
<activity android:name=".ui.activity.MainActivity"
android:launchMode = "singleTop">
</activity>
<service android:name=".service.MediaPlayerService" />
<activity android:name="android.support.wearable.activity.ConfirmationActivity" />
<!--
Main music service, provides media browsing and media playback services to
consumers through MediaBrowserService and MediaSession. Consumers connect to it through
MediaBrowser (for browsing) and MediaController (for play session control)
-->
<service android:name=".service.FsService" />
<service android:name=".service.NsdService" />
<receiver
android:name=".service.NsdService$StartStopReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.turndapage.navmusic.FTPSERVER_STARTED" />
<action android:name="com.turndapage.navmusic.FTPSERVER_STOPPED" />
</intent-filter>
</receiver>
<!-- Don't export this receiver in free, this clashes with paid -->
<receiver
android:name=".RequestStartStopReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.turndapage.navmusic.ACTION_START_FTPSERVER" />
<action android:name="com.turndapage.navmusic.ACTION_STOP_FTPSERVER" />
</intent-filter>
</receiver>
<receiver android:name=".WifiStateChangeReceiver">
<intent-filter>
<action android:name="android.net.wifi.STATE_CHANGE" />
</intent-filter>
</receiver>
<service android:name=".WifiStateChangeReceiver$StartServerService" />
<service android:name=".WifiStateChangeReceiver$StopServerService" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<service
android:name=".watchface.AnalogComplicationWatchFaceService"
android:enabled="true"
android:label="#string/my_analog_name"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="#drawable/preview_analog" />
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="#drawable/preview_analog" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="com.turndapage.navmusic.CONFIG_COMPLICATION_SIMPLE"/>
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
<activity android:name="android.support.wearable.complications.ComplicationHelperActivity"/>
<activity
android:name=".config.AnalogComplicationConfigActivity"
android:label="#string/analog_complication_config">
<intent-filter>
<action android:name="com.turndapage.navmusic.CONFIG_COMPLICATION_SIMPLE"/>
<category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<receiver android:name=".provider.ComplicationToggleReceiver"/>
<activity android:name=".config.ColorSelectionActivity"/>
<service android:name=".provider.CurrentSongComplicationProvider"
android:icon="#drawable/ic_library_music_white_24dp"
android:label="#string/current_song"
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER">
<intent-filter>
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/>
</intent-filter>
<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="SHORT_TEXT,LONG_TEXT"/>
<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="0"/>
</service>
<service android:name=".provider.SkipBackComplicationProvider"
android:icon="#drawable/ic_skip_previous_white_24dp"
android:label="#string/skip_back"
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER">
<intent-filter>
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/>
</intent-filter>
<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="ICON"/>
<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="0"/>
</service>
<service android:name=".provider.SkipForwardComplicationProvider"
android:icon="#drawable/ic_skip_next_white_24dp"
android:label="#string/skip_next"
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER">
<intent-filter>
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/>
</intent-filter>
<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="ICON"/>
<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="0"/>
</service>
<service android:name=".provider.PlayPauseComplicationProvider"
android:icon="#drawable/ic_media_play_dark"
android:label="#string/play_pause"
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER">
<intent-filter>
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/>
</intent-filter>
<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="ICON"/>
<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="0"/>
</service>
<!-- Watch face stuff -->
</application>
Mobile Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.turndapage.navmusic"
minSdkVersion 15
targetSdkVersion 26
versionCode 260350011
versionName "0.3.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
wearAppUnbundled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Wear gradle:
plugins {
id "me.tatarka.retrolambda" version "3.5.0"
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.turndapage.navmusic"
minSdkVersion 23
targetSdkVersion 26
versionCode 260350010
versionName "0.3.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// Needed for retrolambda
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.support:wearable:2.0.3'
compile 'com.android.support:wear:26.0.1'
compile 'com.google.android.gms:play-services-wearable:11.0.4'
compile 'com.google.android.exoplayer:exoplayer:r2.4.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.github.kabouzeid:app-theme-helper:1.3.7'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:preference-v7:26.0.1'
compile 'com.android.support:mediarouter-v7:26.0.1'
compile 'com.android.support:percent:26.0.1'
compile 'net.vrallev.android:cat:1.0.5'
compile 'org.projectlombok:lombok:1.16.18'
compile 'com.twofortyfouram:android-plugin-client-sdk-for-locale:4.0.2'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
compile 'com.google.android.gms:play-services-fitness:11.0.4'
compile 'com.android.support:palette-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
provided 'com.google.android.wearable:wearable:2.0.3'
}
[Edit] I had to update to include complication permissions and remove the watch feature on the mobile app to get it to upload to the play store. Some users report it is installing, but others can't get it to work.
Your assumption is correct, you should not embed the wear APK inside the phone APK (this was the old way of doing it). However, you still need to publish the phone APK.
There are only 2 APKs in your screen shot. There should be 3 in total: phone APK for AW 1.x, wear APK for AW 1.x, and wear APK for AW 2.x.
Make sure that the AW 2.0 APK has the highest version code, followed by the AW 1.x watch APK, and finally the AW 1.x phone APK.
Note that that the wearAppUnbundled true flag (in your phone gradle file) is only needed if you've previously published an AW 1.x app with an embedded wear APK (but it shouldn't hurt to include it otherwise).
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.
In a strange turn of events, adding GCM to my android project is somehow breaking it.
Trying to debug the project in either an emulator or on a device results in a "Failure [install_parse_failed_no_certificates]." Which makes no sense as A) debugging the application worked perfectly fine prior to adding GCM and works when I remove GCM and B) debugging from Android Studio automatically signs the resultant apk.
I then created a new project and added GCM to it, and it ran just fine. Adding all of the original files to this new project however breaks it, causing the same messages as above.
To be clear, it builds perfectly fine, it (supposedly) signs when I attempt to manually sign it perfectly fine, but installing it is failing from both Android Studio and manual attempts to install.
Any help or insights on what the issue(s) could be would be most appreciated.
Edited to include the build config files.
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.app" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!-- [START gcm_permission] -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- [END gcm_permission] -->
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- [START gcm_receiver] -->
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.company.app" />
</intent-filter>
</receiver>
<!-- [END gcm_receiver] -->
<!-- [START gcm_listener] -->
<service
android:name="com.company.app.AppGcmListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<!-- [END gcm_listener] -->
<!-- [START instanceId_listener] -->
<service
android:name="com.company.app.AppInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<!-- [END instanceId_listener] -->
<service
android:name="com.company.app.RegistrationIntentService"
android:exported="false">
</service>
<activity
android:name="com.company.app.RegisterActivity"
android:label="#string/title_activity_register"
android:windowSoftInputMode="adjustPan" >
</activity>
< !-- More activities -- >
</application>
</manifest>
app gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.company.app"
minSdkVersion 21
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 files('libs/bcpkix-jdk15on-152.jar')
compile files('libs/gson-2.3.1.jar')
compile files('libs/bcprov-jdk15on-152.jar')
compile project(':volley-release')
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'org.whispersystems:curve25519-android:0.2.4'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile 'com.squareup.okio:okio:1.5.0'
}
top-level gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.google.gms:google-services:1.4.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Google has released I/O 2014 android app, since it must be an valuable android app demo, so I decided to download it and tried to debug it. But, unfortunately, while I was trying to run it after compiling, it said "This app won't run unless you update google play services", actually the google play services on my phone(Nexus 5, Kitkat 4.4.4) is already the newest. So, in my perspective, I thought it was related to the server configurations, because the I/O app uses some google services, like google plus, google map, etc. I followed the official instructions, but instantly I stuck at the first step:After I renamed the package name in the manifest file(using Android Studio refactoring feature, it will change the activity names accordingly) and refactored the R class imports in the java classes(refactoring by moving the old generated R.java to the new package, it will rearrange the corresponding “.R” imports in all related classes), the app failed to run and complained as followings:
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.google.samples.apps.iosched/.ui.BrowseSessionsActivity }
Error type 3
Error: Activity class {com.google.samples.apps.iosched/com.google.samples.apps.iosched.ui.BrowseSessionsActivity} does not exist.
My new package name is “com.enlangtech.samples.apps.iosched”. I have tried to build a trial app and I am sure now that the app package name can be different with the package that activity classes belong to. So I can’t understand where is the problem. Any one could help me? Thanks for advance!
I had the same error after renaming/refactoring. What I did was add the applicationId property attribute to my build.gradle file, and set its value to the application package.
Like this:
build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:19.1.+'
compile 'com.google.android.gms:play-services:4.3.23'
}
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
applicationId "packageName"
minSdkVersion 16
targetSdkVersion 19;
}
buildTypes {
release{
runProguard true
proguardFile file('path_to_proguard_file\\proguard-project.txt')
proguardFile getDefaultProguardFile('proguard-android.txt')
}
debug{
runProguard false
}
}
}
androidmanifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myfullpackagename"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="#drawable/launcher_icon"
android:label="#string/app_name"
android:name="mypackagename">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
<activity
android:name="package.Activity"
android:label="#string/app_name"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="package.SettingsActivity"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE"/>
<action android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".AboutScreen"/>
<service android:name="package.Service"
android:exported="false"/>
<receiver android:name="package.Alarm"/>
<receiver android:name="package.MyBroadcastReceiver">
<intent-filter>
<action android:name="package.MY_BROADCAST_RECEIVER"/>
</intent-filter>
</receiver>
<receiver android:name="package.MyBroadcastReceiver2">
<intent-filter>
<action android:name="package.MY_BROADCAST_RECEIVER_2"/>
</intent-filter>
</receiver>
</application>
</manifest>