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
}
Related
Well, actually, I am a newbie to android. I have been trying to develop an app that has google maps, and everything was going fine until today when I got this error from the emulator.
Here are some files in case it may be helpful.
Manifest XML 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.example.uaproject">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<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/Theme.UAProject">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".Hotels"
android:exported="true"
android:parentActivityName=".HomeScreen" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
<activity
android:name=".NoteEditorActivity"
android:exported="true"
android:parentActivityName=".HomeScreen" />
<activity
android:name=".AboutApp"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".Copyrights"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".ToAboutBayanOlgey"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".ToAboutUs"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".Menu"
android:exported="true"
android:parentActivityName=".HomeScreen" />
<activity
android:name=".HomeScreen"
android:exported="true" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
build.gradle-app level
plugins {
id 'com.android.application'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.uaproject"
minSdk 19
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.github.smarteist:autoimageslider:1.3.9'
implementation 'com.google.android.material:material:<version>'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
build.gradle-root level
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.1"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
PS: By the way, if you guys have time, could you please guide me on how to add google maps to an already-created fragment(for example, my fragment is the one of a bottom navigation). I have been searching but all I tried did not work for some reason. Or just a link to the valid way would do because there seemed to be many obsolete approaches to this as well, which we beginners cannot really discern.
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'm trying to add GCM to my app, so I'm following this guide.
But I'm getting unresolved symbol error on:
import android.support.v7.app.AppCompatActivity;
and on my R library
This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.examplegcm"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="com.example.examplegcm.permission.C2D_MESSAGE"/>
<uses-permission android:name="com.google.android.c2dm.permission.SEND"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/MyTheme" >
<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" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.example.examplegcm" />
</intent-filter>
</receiver>
<service
android:name="com.example.examplegcm.chatGCM.MyGcmListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="com.example.examplegcm.chatGCM.MyInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<activity
android:name=".MainApplication"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoDisplay" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</application>
</manifest>
Here are my gradles:
Top Level:
// 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.2.3'
classpath 'com.google.gms:google-services:1.3.0-beta1'
}
}
allprojects {
repositories {
jcenter()
}
}
App:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.alaarami.letsrun"
minSdkVersion 16
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.3'
compile files('libs/slf4j-api-1.7.12.jar')
compile files('libs/slf4j-simple-1.7.12.jar')
apply plugin: 'com.google.gms.google-services'
compile 'com.google.android.gms:play-services:7.5.0'
}
Compile Sdk Version: 16
Build Tools Version: 22.0.1
jdk: 1.8
Installed SDK's:
UPDATE:
It's resolved... I dunno how. Didn't do anything
Add to your dependencies
compile 'com.android.support:appcompat-v7:21.0.3'
This is the artifact that contains AppCompatActivity.
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')