Я разрабатываю приложение android wear для носимого устройства, на котором не установлены службы Google Play (для региона Китая). Но приложение не запускается со следующим исключением:
Could not find wearable shared library classes. Please add <uses-library android:name="com.google.android.wearable" android:required="false" /> to the application manifest
Я уже добавил эту строку в мой файл манифеста, но все равно выдает то же исключение. Ниже приведены файлы манифеста и Gradle:
AndroidManifest. xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xyz.abcd">
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<uses-library
android:name="com.google.android.wearable"
android:required="false" />
<!-- Set to true if your app is Standalone, that is, it does not require the handheld app to run. -->
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="true" />
<activity
android:name=".AbcActivity"
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>
приложение: build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.xyz.abcd"
minSdkVersion 26
targetSdkVersion 28
versionCode 5
versionName "1.0.4"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
buildToolsVersion = '27.0.3'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.wear:wear:1.0.0'
implementation 'com.google.android.gms:play-services-wearable:10.2.0'
implementation 'com.google.android.support:wearable:2.5.0'
compileOnly 'com.google.android.wearable:wearable:2.5.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha05'
}
Я провел большой поиск по этому поводу, но я не могу найти подходящего решения, которое работает.
Пожалуйста, помогите!
Заранее спасибо!