On implementing dotup_flutter_wear and any other plugin, the second plugin doesn't seem to be registered right and throws a MissingPluginException when one of it's methods is called (location.serviceEnabled() in _test of the example app)
Though no error is thrown on compiling
When disabling dotup_flutter_wear the second plugin runs prefect, also when combining the second plugin with other plugins while dotup_flutter_wear is disabled
When using an adjusted MainActivity.kt (code see below, commented as Debug), this error is thrown:
E/AndroidRuntime(17411): FATAL EXCEPTION: main
E/AndroidRuntime(17411): Process: com.example.location_test, PID: 17411
E/AndroidRuntime(17411): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/wearable/compat/WearableActivityController$AmbientCallback;
E/AndroidRuntime(17411): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:19)
E/AndroidRuntime(17411): at com.example.location_test.MainActivity.configureFlutterEngine(MainActivity.kt:19)
E/AndroidRuntime(17411): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:187)
E/AndroidRuntime(17411): at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:430)
E/AndroidRuntime(17411): at android.app.Activity.performCreate(Activity.java:7802)
E/AndroidRuntime(17411): at android.app.Activity.performCreate(Activity.java:7791)
E/AndroidRuntime(17411): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
E/AndroidRuntime(17411): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
E/AndroidRuntime(17411): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
E/AndroidRuntime(17411): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
E/AndroidRuntime(17411): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(17411): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(17411): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
E/AndroidRuntime(17411): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(17411): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(17411): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime(17411): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(17411): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime(17411): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/AndroidRuntime(17411): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.wearable.compat.WearableActivityController$AmbientCallback" on path: DexPathList[[zip file "/data/app/com.example.location_test-dJv1-nE_8TksMKlK3h80kw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.location_test-dJv1-nE_8TksMKlK3h80kw==/lib/x86, /data/app/com.example.location_test-dJv1-nE_8TksMKlK3h80kw==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
E/AndroidRuntime(17411): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
E/AndroidRuntime(17411): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(17411): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(17411): ... 19 more
Remarks:
I'm using "androidx.wear:wear" version 1.1.0 in app gradle to get it compiled in Android SDK 30; see issue #1
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.location_test"
minSdkVersion 23
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation("androidx.wear:wear"){
version {
strictly '1.1.0'
}
}
}
android\app\src\Main\AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.location_test">
<application
android:label="location_test"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
What's the issue:
dotup_flutter_wear
and any other plugin, the second plugin doesn't seem to be registered right and throws aMissingPluginException
when one of it's methods is called (location.serviceEnabled()
in_test
of the example app)dotup_flutter_wear
the second plugin runs prefect, also when combining the second plugin with other plugins whiledotup_flutter_wear
is disabledRemarks:
What I've tried:
flutter clean
, manually deleting cached plugins, ...<meta-data android:name="flutterEmbedding" android:value="2" />
in AndroidManifestmultiDexEnabled true
withimplementation 'androidx.multidex:multidex:2.0.1'
in android\app\build.gradleExample:
location
location
pluginmain.dart
pubspec.yaml
android\build.gradle
android\app\build.gradle
android\app\src\Main\AndroidManifest.xml
android\app\src...\MainActivity.kt
android\app\src...\GeneralPluginRegistrant.java (auto-generated)
flutter doctor --verbose