Closed CaLouro closed 3 years ago
@CaLouro if the problem is with firebase the issue should be opened here
Hey @iapicca I don't think the problem is with Firebase. For me it looks like an error with Flutter Engine that errors a Firebase API
But thanks for reminding me of the flutterfire repo, I'll see if something like this was posted there
Hi @CaLouro
Can you please check your gradle version is 3.5.0 in your build.gradle
in the flutter app -> Android
Makes sure it is classpath 'com.android.tools.build:gradle:3.5.0
and not higher Reference
If the problem persists, Can you please provide your build.gradle
, your MainActivity
, your flutter run --verboze
, your pubspec.yaml
Thank you
Hi @TahaTesser, checking what you asked for:
I was trying to reproduce the error, but I couldn't, it doesn't show every time, so I'm not including the flutter run -v
log, sorry. If I eventually can, I'll sent it.
Thanks for all the help.
Hi @CaLouro You can manually register plugins with FlutterEngine with the following
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
If the problem still persists using this, please provide complete logs Thank you
@TahaTesser I've added this code piece you suggested but I got the following error
Launching lib\main.dart on SM G965U1 in debug mode...
Running Gradle task 'assembleDebug'...
e: C:\Users\caios\Desktop\boi_na_balanca\android\app\src\main\kotlin\com\gmail\dev\caiolouro\boi_na_balanca\MainActivity.kt: (7, 5): 'configureFlutterEngine' overrides nothing
e: C:\Users\caios\Desktop\boi_na_balanca\android\app\src\main\kotlin\com\gmail\dev\caiolouro\boi_na_balanca\MainActivity.kt: (7, 56): Unresolved reference: FlutterEngine
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 8s
Exception: Gradle task assembleDebug failed with exit code 1
My MainActivity.kt at the time was
package com.gmail.dev.caiolouro.boi_na_balanca
import io.flutter.embedding.android.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
flutter doctor -v
[√] Flutter (Channel stable, 1.20.3, on Microsoft Windows [versão
10.0.19041.450], locale pt-BR)
• Flutter version 1.20.3 at C:\Users\caios\Documents\flutter
• Framework revision 216dee60c0 (7 days ago), 2020-09-01 12:24:47 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\caios\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.48.2)
• VS Code at C:\Users\caios\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.14.0
[√] Connected device (1 available)
• SM G965U1 (mobile) • 35494b4435563098 • android-arm64 • Android 10 (API 29)
• No issues found!
@CaLouro
Make sure you've imported flutterEngine Open your Android folder in Android Studio, you will see missing import errors
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
@TahaTesser Made my MainActivity.kt exactly like yours and this error showed up and the app crashed at launch.
Launching lib\main.dart on SM G965U1 in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build\app\outputs\flutter-apk\app-debug.apk.
W/FlutterEnginePluginRegistry(10329): Attempted to register plugin (io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry$ShimRegistrarAggregate@99db182) but it was already registered with this FlutterEngine (io.flutter.embedding.engine.FlutterEngine@c66093).
E/AndroidRuntime(10329): FATAL EXCEPTION: main
E/AndroidRuntime(10329): Process: com.gmail.dev.caiolouro.boi_na_balanca, PID: 10329
E/AndroidRuntime(10329): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gmail.dev.caiolouro.boi_na_balanca/com.gmail.dev.caiolouro.boi_na_balanca.MainActivity}: java.lang.IllegalStateException: registrar.context() must not be null
E/AndroidRuntime(10329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3632)
E/AndroidRuntime(10329): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3784)
E/AndroidRuntime(10329): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
E/AndroidRuntime(10329): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(10329): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(10329): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2270)
E/AndroidRuntime(10329): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(10329): at android.os.Looper.loop(Looper.java:237)
E/AndroidRuntime(10329): at android.app.ActivityThread.main(ActivityThread.java:8125)
E/AndroidRuntime(10329): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10329): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
E/AndroidRuntime(10329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
E/AndroidRuntime(10329): Caused by: java.lang.IllegalStateException: registrar.context() must not be null
E/AndroidRuntime(10329): at com.shatsy.admobflutter.AdmobFlutterPlugin$Companion.registerWith(AdmobFlutterPlugin.kt:32)
E/AndroidRuntime(10329): at com.shatsy.admobflutter.AdmobFlutterPlugin.registerWith(Unknown Source:2)
E/AndroidRuntime(10329): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:18)
E/AndroidRuntime(10329): at com.gmail.dev.caiolouro.boi_na_balanca.MainActivity.configureFlutterEngine(MainActivity.kt:11)
E/AndroidRuntime(10329): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:180)
E/AndroidRuntime(10329): at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:411)
E/AndroidRuntime(10329): at android.app.Activity.performCreate(Activity.java:7957)
E/AndroidRuntime(10329): at android.app.Activity.performCreate(Activity.java:7946)
E/AndroidRuntime(10329): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
E/AndroidRuntime(10329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3607)
E/AndroidRuntime(10329): ... 11 more
Waiting for SM G965U1 to report its views...
Debug service listening on ws://127.0.0.1:52934/dZRdLonfa6M=/ws
Syncing files to device SM G965U1...
I/Process (10329): Sending signal. PID: 10329 SIG: 9
Hi @CaLouro Can you please a different device or emulator?
@TahaTesser ok, tested the main activity like you suggested plus I ran flutter clean before the test.
This time I tested on an emulator (before I was using a real device) and the app still crashes and I get this error
Launching lib\main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
W/FlutterEnginePluginRegistry( 9107): Attempted to register plugin (io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry$ShimRegistrarAggregate@719ddfd) but it was already registered with this FlutterEngine (io.flutter.embedding.engine.FlutterEngine@654caf2).
Waiting for sdk gphone x86 to report its views...
Debug service listening on ws://127.0.0.1:63464/SjpzMupP2dU=/ws
Syncing files to device sdk gphone x86...
I/Process ( 9107): Sending signal. PID: 9107 SIG: 9
Lost connection to device.
Could not update files on device: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:63464/SjpzMupP2dU=/
Hi @CaLouro
Can you please do me favor and remove futterfire and comment out its code and try again
You can remove configure engine code and make sure this in your AndroidManifest.xml
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
<application
android:name="io.flutter.app.FlutterApplication"
android:label="plugin_error"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
https://github.com/flutter/flutter/issues/65525 had a similar issue, this fixed the issue https://github.com/flutter/flutter/issues/65525#issuecomment-690093089
Hey @TahaTesser, sorry for the long wait.
I haven't seen this error in a while and the errors with flutterfire dropped significantly. I think the problem was with the gradle version and sdk versions that I kept updating without reason.
I'll close this issue for now too.
Thanks for everything and take care.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Hello everyone.
I've been getting this error on flutter console and I don't know what it means or implies, and I'd like some help.
W/FlutterEngine(30444): Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@7a0372e) but could not find and invoke the GeneratedPluginRegistrant.
This error doesn't show 100% of the time, but it's very frequent. Additionally I've been getting errors on Firebase Installations API and I thought this could be the reason.
I thank any help on this problem.
Logs
``` flutter analyze Analyzing