我的Android Wear应用程序间歇性地崩溃,并出现非法状态异常,告诉我添加
Caused by: java.lang.IllegalStateException: Could not find wearable shared library classes. Please add uses-library android:name="com.google.android.wearable" android:required="false" /> to the application manifest
我在下面看过这个帖子,但是我的"使用了库"你可以看到声明在申请部分。
Crash loading WearableActivity
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.turndapage.navmusic">
<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" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<!-- 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" />
的build.gradle
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.support:wearable:2.0.5'
compile 'com.android.support:wear:26.0.1'
compile 'com.google.android.gms:play-services-wearable:11.0.4'
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.1.1'
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.1.1'
provided 'com.google.android.wearable:wearable:2.0.5'
}
我的另一个磨损应用程序出现了同样的错误。这是它的依赖。
repositories {
jcenter()
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.dom4j:dom4j:2.1.0'
compile 'commons-io:commons-io:2.5'
compile 'com.google.android.support:wearable:2.0.5'
compile 'com.android.support:wear:26.0.1'
compile 'com.google.android.gms:play-services-wearable:11.0.4'
compile 'net.vrallev.android:cat:1.0.5'
compile 'com.google.code.gson:gson:2.8.2'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.github.bumptech.glide:glide:4.1.1'
compile 'com.github.kabouzeid:app-theme-helper:1.3.7'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:palette-v7:26.0.1'
compile 'com.android.support:preference-v7:26.0.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
compile 'com.google.android.exoplayer:exoplayer:r2.5.3'
compile project(':audiosearch');
compile 'com.android.support:support-v4:26.0.1'
provided 'com.google.android.wearable:wearable:2.0.5'
}
这是一款独立的佩戴应用程序。