Reputation: 175
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?
Upvotes: 2
Views: 2729
Reputation: 4835
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.
Upvotes: 3