Closed zekiegitimcom closed 5 years ago
What do you mean "when I am executing, the app is closing"?
If your app is crashing, don't you think the stacktrace in $ adb logcat
might contain interesting information, such as the cause of the crash?
that command for mac i guess. i use windows 10.
C:\src\flutter_projects\back_work>adb logcat 'adb' is not recognized as an internal or external command, operable program or batch file.
yes i did it.
i tried my cell-phone (with usb cable) too. nothing has changed. i hope you'll find the problem.
com.example.back_work.Application
? I have no idea what's wrong.04-29 18:31:56.219 21638 21638 E AndroidRuntime: FATAL EXCEPTION: main
04-29 18:31:56.219 21638 21638 E AndroidRuntime: Process: com.example.back_work, PID: 21638
04-29 18:31:56.219 21638 21638 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application com.example.back_work.Application: java.lang.ClassNotFoundException: Didn't find class "com.example.back_work.Application" on path: DexPathList[[zip file "/data/app/com.example.back_work-D6TEgZbXiTTII9KpNE4AbQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.back_work-D6TEgZbXiTTII9KpNE4AbQ==/lib/arm64, /data/app/com.example.back_work-D6TEgZbXiTTII9KpNE4AbQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.app.LoadedApk.makeApplication(LoadedApk.java:1060)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5877)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.app.ActivityThread.access$1100(ActivityThread.java:200)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1660)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6762)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.back_work.Application" on path: DexPathList[[zip file "/data/app/com.example.back_work-D6TEgZbXiTTII9KpNE4AbQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.back_work-D6TEgZbXiTTII9KpNE4AbQ==/lib/arm64, /data/app/com.example.back_work-D6TEgZbXiTTII9KpNE4AbQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.app.Instrumentation.newApplication(Instrumentation.java:1121)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: at android.app.LoadedApk.makeApplication(LoadedApk.java:1052)
04-29 18:31:56.219 21638 21638 E AndroidRuntime: ... 9 more
yes that is my app's name.
did you check my AndroidManifest.xml? maybe the error is there.
Does your Android app have an Application.java
?
yes.
It's assumed that you'd understand that you need to change the namespace of the copied Application.java
to your app's namespace, which is com.example.back_work
+package com.example.back_work;
import com.transistorsoft.flutter.backgroundfetch.BackgroundFetchPlugin;
import com.transistorsoft.flutter.backgroundgeolocation.FLTBackgroundGeolocationPlugin;
import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class Application extends FlutterApplication implements PluginRegistry.PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
FLTBackgroundGeolocationPlugin.setPluginRegistrant(this);
BackgroundFetchPlugin.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
Yes, it is working now. Problem solved.
You must remind it, in that page:
https://github.com/transistorsoft/flutter_background_fetch/blob/master/help/INSTALL-ANDROID.md
I always see this text: "Running Gradle task 'assembleDebug'..." and it is never end.
background_fetch
flutter info
,flutter doctor
):flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.706], locale tr-TR) [√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [√] Android Studio (version 3.3) [√] VS Code (version 1.33.1) [√] Connected device (1 available)
• No issues found!
AndroidManifest.xml :