I have tested bannerAds it is working correctly but when I try to load interstitial ad it crashes the app.
MinSdkVersion 29
I have tried to load the ad in initState and the build method separately.
Banner ads are running correctly.
InterstitialAd loadInterstitialAd() {
return InterstitialAd(
adUnitId: "ca-app-pub-3940256099942544/1033173712",
listener: AdListener(onAdLoaded: (_) {
setState(() {
_isAdLoaded = true;
});
}, onAdFailedToLoad: (_ad, error) {
_ad.dispose();
print("Ad Exited with error $error");
}, onAdClosed: (_ad) {
Navigator.pop(context);
_ad.dispose();
}),
request: AdRequest());
}
#override
Widget build(BuildContext context) {
InterstitialAd _ad = loadInterstitialAd();
_ad.load();
return Scaffold(
body: Center(
child: MaterialButton(
onPressed: () {},
color: Colors.red,
)
),
);
}
Error log is like
E/AndroidRuntime(22505): FATAL EXCEPTION: main
E/AndroidRuntime(22505): Process: tech.deepaksharma.statussaver, PID: 22505
E/AndroidRuntime(22505): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/InterstitialAd;
E/AndroidRuntime(22505): at io.flutter.plugins.googlemobileads.FlutterInterstitialAd.load(FlutterInterstitialAd.java:70)
E/AndroidRuntime(22505): at io.flutter.plugins.googlemobileads.GoogleMobileAdsPlugin.onMethodCall(GoogleMobileAdsPlugin.java:299)
E/AndroidRuntime(22505): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/AndroidRuntime(22505): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/AndroidRuntime(22505): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/AndroidRuntime(22505): at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(22505): at android.os.MessageQueue.next(MessageQueue.java:343)
E/AndroidRuntime(22505): at android.os.Looper.loop(Looper.java:188)
E/AndroidRuntime(22505): at android.app.ActivityThread.main(ActivityThread.java:7582)
E/AndroidRuntime(22505): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(22505): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime(22505): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
E/AndroidRuntime(22505): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.InterstitialAd" on path: DexPathList[[zip file "/data/app/tech.deepaksharma.statussaver-7ebD-4rtvclB1sSW4YF-Lw==/base.apk"],nativeLibraryDirectories=[/data/app/tech.deepaksharma.statussaver-7ebD-4rtvclB1sSW4YF-Lw==/lib/arm64, /data/app/tech.deepaksharma.statussaver-7ebD-4rtvclB1sSW4YF-Lw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]
E/AndroidRuntime(22505): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
E/AndroidRuntime(22505): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(22505): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(22505): ... 12 more
I/Process (22505): Sending signal. PID: 22505 SIG: 9
Lost connection to device.
I had the same issue, and fixed it by adjusting some dependencies in my build.gradle file.
The problem seems to be caused by play-services-ads version 20, which moves the InterstitialAd class to the namespace "com.google.android.gms.ads.interstitial" (previously it was in namespace "com.google.android.gms.ads").
The Flutter plugin Google Mobile Ads version 0.12.1+1 uses play-services-ads version 19.7, so it tries to load the InterstitialAd class from the old namespace. The problem in my case is that we use Admob mediation, and we use third party mediation adapters. The latest versions of these adapters were using play-services-ads version 20, and that caused the issue. The solution for me was checking the change log in the Admob mediation page, for each adapter we use, and then include the version of the adapter using play-services-ads version 19.7. For example, we use:
implementation 'com.google.ads.mediation:adcolony:4.4.1.0'
implementation 'com.google.ads.mediation:applovin:9.15.2.0'
implementation 'com.google.ads.mediation:tapjoy:12.7.1.0'
implementation 'com.google.ads.mediation:facebook:6.3.0.1'
EDIT: Google just released the google_mobile_ads package version 0.13.0, which targets GMA for Android dependency version 20.1.0, so the issue will be gone if you update this package.
try updating to the latest Google Mobile Ads SDK first
Related
Ive created a simple flutter program to test out the plugin on flutter. ive set up a simple unity project with a button and imported it using the plugin to the flutter project. everything builds up correctly and my app runs, however the app crashes upon loading the UnityWidget
To Reproduce
Steps to reproduce the behavior:
create simple app in unity and flutter
exported unity as per instructions on Readme
moved unityLibrary from 'project Root/unity/android' to 'project Root/android' in order to fix unityLibrary not found build error
UnityWidgetController? overallController;
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Second Route'),
),
body: SafeArea(
top: true,
bottom: true,
child: Stack(
children: [
UnityWidget(
onUnityCreated: onUnityCreate,
borderRadius: BorderRadius.zero,
),
],
),
),
);
}
void onUnityCreate(UnityWidgetController controller) {
overallController = controller;
controller.postMessage("ButtonManager", "setFromFlutter", "message");
}
**Unity (please complete the following information): ver 2020.3.5f1
OS: MacOS BigSur 11.4 (20F71)
Smartphone (please complete the following information):
OnePlus 5T Android 10
heres the error message
W/Gralloc3(31563): mapper 3.x is not supported
I/IL2CPP (31563): JNI_OnLoad
E/_flutter_widge(31563): Invalid ID 0x00000000.
D/AndroidRuntime(31563): Shutting down VM
E/AndroidRuntime(31563): FATAL EXCEPTION: main
E/AndroidRuntime(31563): Process: com.example.unity_flutter_widget, PID: 31563
E/AndroidRuntime(31563): android.content.res.Resources$NotFoundException: String resource ID #0x0
E/AndroidRuntime(31563): at android.content.res.Resources.getText(Resources.java:367)
E/AndroidRuntime(31563): at android.content.res.Resources.getString(Resources.java:460)
E/AndroidRuntime(31563): at com.unity3d.player.UnityPlayer.GetGlViewContentDescription(Unknown Source:20)
E/AndroidRuntime(31563): at com.unity3d.player.UnityPlayer.<init>(Unknown Source:271)
E/AndroidRuntime(31563): at com.xraph.plugin.flutter_unity_widget.UnityPlayerUtils$Companion$createPlayer$1.run(UnityPlayerUtils.kt:45)
E/AndroidRuntime(31563): at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime(31563): at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime(31563): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(31563): at android.app.ActivityThread.main(ActivityThread.java:7697)
E/AndroidRuntime(31563): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(31563): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
E/AndroidRuntime(31563): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
D/ViewRootImpl[MainActivity](31563): windowFocusChanged hasFocus=false inTouchMode=true
I/Process (31563): Sending signal. PID: 31563 SIG: 9
Lost connection to device.
Exited (sigterm)
After a few days of googling, i managed to find the answer.
After exporting to android, i needed to enter this
<string name="game_view_content_description">Game view</string>
into the styles.xml file, within the resources tag
it is located in unityLibrary/src/main/res/values
I've read a few answers on this site with the same or similar error messages, and I've tried all the solutions already. Sadly, none of them have worked so far.
My gradle files all look like they're properly set up for Multidex, the Application class extends MultiDexApplication and is referenced correctly in the manifest, I've cleaned all caches and restarted the IDE, deleting builds from the project and the device and re-building/re-installing, etc. etc.
Inspecting the APK, I found the Application in classes2.dex, correctly referencing .super Landroidx/multidex/MultiDexApplication;
The stack I'm getting is like this:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.<REDACTED>, PID: 25475
java.lang.RuntimeException: Unable to instantiate application com.<REDACTED>.Application: java.lang.ClassNotFoundException: Didn't find class "com.<REDACTED>.Application" on path: DexPathList[[zip file "/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/base.apk"],nativeLibraryDirectories=[/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1306)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7401)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7374)
at android.app.ActivityThread.access$1500(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2118)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8425)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.<REDACTED>.Application" on path: DexPathList[[zip file "/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/base.apk"],nativeLibraryDirectories=[/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
at android.app.Instrumentation.newApplication(Instrumentation.java:1158)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1298)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7401)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7374)
at android.app.ActivityThread.access$1500(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2118)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8425)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Suppressed: java.io.IOException: Failed to open dex files from /data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/base.apk because: Failure to verify dex file '/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/base.apk': Bad index for method_handle_item method_idx: ffff >= de57
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:367)
at dalvik.system.DexFile.<init>(DexFile.java:109)
at dalvik.system.DexFile.<init>(DexFile.java:82)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:439)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:398)
at dalvik.system.DexPathList.<init>(DexPathList.java:166)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:129)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:104)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:74)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:87)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:116)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:114)
at android.app.ApplicationLoaders.getClassLoaderWithSharedLibraries(ApplicationLoaders.java:60)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:933)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:990)
at android.app.LoadedApk.getResources(LoadedApk.java:1234)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2788)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7263)
... 8 more
Can anyone figure out what this is all about?
In the module level build.gradle, we added these lines:
// Near the top
apply plugin: 'com.google.firebase.crashlytics'
// ...
android {
// ...
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
// ...
}
// ...
I have no idea how this fixed this crash, but I suppose that's what I get for using "It just works" libraries.
While doing phone number authentication on firebase i'm getting crash with this error message. please help.
com.russvkm.chathut is my package name
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.russvkm.chathut, PID: 24323
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/browser/customtabs/CustomTabsIntent$Builder;
at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth##20.0.0:92)
at com.google.firebase.auth.api.internal.zzeq.zza(com.google.firebase:firebase-auth##20.0.0:79)
at com.google.firebase.auth.api.internal.zzeq.onPostExecute(com.google.firebase:firebase-auth##20.0.0:88)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.access$600(AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.browser.customtabs.CustomTabsIntent$Builder" on path: DexPathList[[zip file "/data/app/com.russvkm.chathut-22XI8m2uPLL7Q6CgxXHPiw==/base.apk"],nativeLibraryDirectories=[/data/app/com.russvkm.chathut-22XI8m2uPLL7Q6CgxXHPiw==/lib/arm, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth##20.0.0:92)
at com.google.firebase.auth.api.internal.zzeq.zza(com.google.firebase:firebase-auth##20.0.0:79)
at com.google.firebase.auth.api.internal.zzeq.onPostExecute(com.google.firebase:firebase-auth##20.0.0:88)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.access$600(AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6826)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
I/Process: Sending signal. PID: 24323 SIG: 9
my application is communicating well with firebase server as i don't find any error or crash while doing email authentication.
I'm using following approach to authenticate
PhoneAuthProvider.verifyPhoneNumber(
PhoneAuthOptions.newBuilder(mAuth)
.setPhoneNumber(phoneNumber)
.setActivity(this)
.setTimeout(60,TimeUnit.SECONDS)
.setCallbacks(object:PhoneAuthProvider.OnVerificationStateChangedCallbacks(){
override fun onVerificationCompleted(credential:PhoneAuthCredential) {
dismissDialog()
val smsCode=credential.smsCode
Log.i("SMS code",smsCode!!)
signInWithPhoneAuthCredential(credential)
}
override fun onVerificationFailed(p0: FirebaseException) {
Toast.makeText(this#Register,p0.message,Toast.LENGTH_SHORT).show()
}
override fun onCodeSent(verificationId: String, token: PhoneAuthProvider.ForceResendingToken) {
super.onCodeSent(verificationId, token)
numberLinearLayout.visibility=View.GONE
otpLinearLayout.visibility=View.VISIBLE
storedVerificationId=verificationId
resendToken=token
dismissDialog()
}
})
.build()
)
programme isn't executing otpSent method it is being crashed without sending otp.
Firebase auth got some major changes, like Recaptcha for human verification.it needs a browser to verify so, Add the below depen. and read about changes refer me
implementation 'androidx.browser:browser:1.2.0'
Update :
If you want to avoid human verification, you need to enable safetynet in google cloud console for your firebase project refer this.
By adding
implementation "androidx.browser:browser:1.3.0"
it solved my problem but user experience was not good because firebase was opening browser to verify Recaptcha and that was looking odd in app flow.
Firebase Quote "The reCAPTCHA flow will only be triggered when SafetyNet is unavailable or your device does not pass suspicion checks. Nonetheless, you should ensure that both scenarios are working correctly."
So to enable SafetyNet follow below steps or you can also visit Firebase Auth for more info.
1.Go to google cloud console , select your project .
2.Click on navigation menu and select APis & services and then select Dashboard.
3.Click on enable api and services and enable api " Android Device Verification".
4.Add SHA 256 in firebase project settings. (debug and release both)
5.Test your app again.(For testing use real device not emulator)
Background
I'm making a fruit classification app using flutter on android studio. The app will work as follows:
Take a picture with the camera.
Predict the type of fruit in the picture.
To do step (2), I'm using a 'model.tflite' file that was exported from teachable machine. I'm also using the tflite plugin for flutter.
The Problem
When my program tries to predict the image, I get the following message in the console:
E/MethodChannel#tflite( 7296): Failed to handle method call
E/MethodChannel#tflite( 7296): java.lang.IllegalArgumentException: Unsupported value: java.io.FileNotFoundException: flutter_assets/assets/model.tflite
E/MethodChannel#tflite( 7296): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:278)
E/MethodChannel#tflite( 7296): at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:69)
E/MethodChannel#tflite( 7296): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:236)
E/MethodChannel#tflite( 7296): at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:98)
E/MethodChannel#tflite( 7296): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226)
E/MethodChannel#tflite( 7296): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#tflite( 7296): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631)
E/MethodChannel#tflite( 7296): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#tflite( 7296): at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#tflite( 7296): at android.os.Looper.loop(Looper.java:197)
E/MethodChannel#tflite( 7296): at android.app.ActivityThread.main(ActivityThread.java:7948)
E/MethodChannel#tflite( 7296): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#tflite( 7296): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#tflite( 7296): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
I/flutter ( 7296):
I/flutter ( 7296): ERROR: PlatformException(error, Unsupported value: java.io.FileNotFoundException: flutter_assets/assets/model.tflite, null)
Flutter can't seem to find the model.tflite file from my assets folder!
What I've tried
I have triple checked the indentations in pubspec.yaml (below). The file paths and names of directories are also correct.
flutter:
assets:
- assets/labels.txt
- assets/model.tflite
I have read the tflite docs.
I've downloaded the model.tflite as a floating point type and quantized type.
I have tried renaming the model.tflite file (you could tell I was getting desperate).
I have also tried changing certain parameters within my code. Below is the function where the error seems to be happening - it is called whenever the user takes a picture.
Future classifyImage() async {
try{
String res = await Tflite.loadModel(
model: 'assets/model.tflite',
labels: 'assets/labels.txt',
numThreads: 1,
isAsset: true,
useGpuDelegate: true
);
print(res);
var recognitions = await Tflite.runModelOnImage(
path: _image.path,
imageMean: 117.0,
imageStd: 1.0,
numResults: 1,
threshold: 0.5,
asynch: true,
);
_recognitions = recognitions;
await Tflite.close();
} catch (error){
print(' ');
print('ERROR: $error');
}
Here is a screenshot of my project directories.
I have also tried flutter clean, quitting android studio and restarting the project.
PLEASE HELP! I'm currently waiting for someone to float from the heavens and magically fix my problem. I'm also a beginner to flutter, so any general suggestions to my code would be greatly appreciated :-).
Thank you.
Go ahead and open the android / app / build.gradle file and add the following code inside the android block.
aaptOptions {
noCompress 'tflite'
noCompress 'lite'
}
I went on my project the next day and the error doesn't seem to be coming up. Not too sure what happened...
Perhaps it was something to do with my laptop?
As the title says, I'm trying to set up anonymous sign in using Firebase firestore for my Flutter app, but it crashes on Android. It works perfectly fine on iOS.
I set up Firebase for my app using the wizard found in the firebase console, and used all the suggested version numbers when configuring the android app.
My dependencies in the android/build.gradle file are as follows:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}
And in the android/app/build.gradle file the following is set:
minSdkVersion 21
targetSdkVersion 28
I also downloaded and placed the google-services.json file into the path android/app
I know I'm connected to Firebase because I set up google analytics and I can see myself as an active user in the analytics panel
This is my set up for the anonymous sign in:
In the "auth.dart" file:
import 'package:firebase_auth/firebase_auth.dart';
class AuthService {
// this instance allows us to communicate with Firebase in the backend
final FirebaseAuth _auth = FirebaseAuth.instance;
// sign in anon
Future signInAnon() async {
try {
AuthResult result = await _auth.signInAnonymously();
FirebaseUser user = result.user;
return user;
} catch (e) {
print(e.toString());
return null;
}
}
and in the SignIn widget, where I use a button that calls the anonSignIn method:
GestureDetector(
onTap: () async {
dynamic result = await _auth.signInAnon();
if (result == null) {
print('error signing in');
} else {
print('anon user signed in');
print(result);
}
},
child: Text(
'Skip for now >',
style: TextStyle(color: eigthColor),
),
),
The app prints the right results for iOS in the debug console, but when running on Android, both the emulator and on a real device (Samsung), the app quits when the button is pressed and all that is shown in the debug console is below. I'm a development noob. Please help!
**
W/BiChannelGoogleApi(11081): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak#c8b9c14
E/AndroidRuntime(11081): Process: com.tsf.freshee_scratch, PID: 11081
E/AndroidRuntime(11081): java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
E/AndroidRuntime(11081): at com.google.firebase.auth.internal.zzam.zzc(Unknown Source:22)
E/AndroidRuntime(11081): at com.google.firebase.auth.internal.zzam.zzde(Unknown Source:17)
E/AndroidRuntime(11081): at com.google.firebase.auth.internal.zzam.zzdd(Unknown Source:8)
E/AndroidRuntime(11081): at com.google.firebase.auth.internal.zzan.zzdf(Unknown Source:1)
E/AndroidRuntime(11081): at com.google.firebase.auth.internal.zzm.isAnonymous(Unknown Source:47)
E/AndroidRuntime(11081): at com.google.firebase.auth.internal.zzat.zzi(Unknown Source:57)
E/AndroidRuntime(11081): at com.google.firebase.auth.internal.zzat.zzg(Unknown Source:10)
E/AndroidRuntime(11081): at com.google.firebase.auth.FirebaseAuth.zza(Unknown Source:62)
E/AndroidRuntime(11081): at com.google.firebase.auth.FirebaseAuth$zzb.zza(Unknown Source:5)
E/AndroidRuntime(11081): at com.google.firebase.auth.api.internal.zzcl.zzdx(Unknown Source:13)
E/AndroidRuntime(11081): at com.google.firebase.auth.api.internal.zzen.zzen(Unknown Source:35)
E/AndroidRuntime(11081): at com.google.firebase.auth.api.internal.zzen.zza(Unknown Source:41)
E/AndroidRuntime(11081): at com.google.firebase.auth.api.internal.zzep.zza(Unknown Source:9)
E/AndroidRuntime(11081): at com.google.firebase.auth.api.internal.zzdx.dispatchTransaction(Unknown Source:9)
E/AndroidRuntime(11081): at com.google.android.gms.internal.firebase_auth.zza.onTransact(Unknown Source:13)
E/AndroidRuntime(11081): at android.os.Binder.execTransact(Binder.java:739)
E/AndroidRuntime(11081): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/com.tsf.freshee_scratch-RyjASMTcDx7DTMAHwjdqeg==/base.apk"],nativeLibraryDirectories=[/data/app/com.tsf.freshee_scratch-RyjASMTcDx7DTMAHwjdqeg==/lib/arm64, /data/app/com.tsf.freshee_scratch-RyjASMTcDx7DTMAHwjdqeg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
E/AndroidRuntime(11081): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/AndroidRuntime(11081): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(11081): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(11081): ... 16 more
D/ViewRootImpl#c13a6a1MainActivity: MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager(11081): prepareNavigationBarInfo() DecorView#5990a33[MainActivity]
D/InputMethodManager(11081): getNavigationBarColor() -352319669
I/Process (11081): Sending signal. PID: 11081 SIG: 9
Lost connection to device.
Exited (sigterm)
**