I added the flutter_local_notifications plugin to schedule notifications. In the debug version everything works well for both emulators and real devices.
However, when I build the app
flutter build apk --split-per-abi
and install the package on a device and run the app, when it comes to the code part that marks the notification (I supposed...) , the app crashes
How do I find out what's wrong?
I followed the plugin developers instructions and changed the manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.explika">
<uses-permission android:name="android.permission.INTERNET" />
<!-- Tudo relacionado com as notificações -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />
<!-- Fim relacionado com notificações -->
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Explika"
android:icon="#mipmap/ic_launcher">
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in #style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
I found out what is causing the application to crash:
[ERROR: flutter / shell / platform / android / platform_view_android_jni.cc (39)] java.lang.AssertionError: java.lang.NoSuchFieldException: Drawable
However, this only happened in the Release version. The solution consists of customizing the ProGuard configuration file and the build.gradle file following the instructions on the plugin page.
I didn't do these steps because until then the Release version worked without problems and because I thought ProGuard configuration file would only be necessary in case want to publish on the Play Store.
Related
My company has a campaign which has an objective to increase te installations of its apps.
Our App was done in Xamarin.Forms 4.8.
I have read many many sites and searched for any tutorial about how to do that, but unfourtunatelly, I do not find anything. There are so many material about FB Login in Xamarin, was nothing about FB Pixel to get events in your xamarin.forms app.
I have read that there is a type of registration of those events in FB, called nocode, where the app sends some basic events to FB, without any code. You just need to install the nuget lib (Android and iOS) and configure AndroidManifest and info.plist files, with the pixel number, which is called FacebookAppId.
Below, is part of my AndroidManifest file:
...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.AD_ID" />
<application android:label="#string/app_name" android:icon="#drawable/balao">
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<provider android:name="android.support.v4.content.FileProvider" android:authorities="io.app.meusebrae.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/file_paths"></meta-data>
</provider>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id" />
<activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="#string/app_name" />
<activity android:name="com.facebook.CustomTabActivity" android:exported="true">
...
Below, part of my info.plist file:
...
<key>FacebookAppID</key>
<string>874......</string>
<key>FacebookDisplayName</key>
<string>Meu Sebrae</string>
...
I have the nuget libs Xamarin.Facebook.Android and Xamarin.Facebook.iOS installed.
According to some sites, it would be the only configuration needed to make it to run, but nothing is sent to FB dashboard, where I monitor the events captured.
So, please, I really need some tutorial or anybody to explain me, what I really need to do, and if I am doing anything wrong.
Thanks.
Marcelo.
I am working on a flutter project with mongoDB, there is no big deal at project I just want to SignUp user, but application works only on debug mode and with my mobile Hotspot. otherwise I just click signUp button and I wait long time, then ********** "SocketException: Connection timed out (OS Error: Connection timed out, errno = 110), address = 10.76.236.118, port = 44670". *********** this error throw. I work with real device android Samsung Galaxy A50 (SM-A505F), I don't think there's any error in the codes. Because it works when debug + specific IP(when I use my mobile hotspot).However, let me share the screenshot of the relevant parts. what are the things I don't know ,about IP or mongoDB or ....
./android/app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.shopping">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="shopping"
android:name="${applicationName}"
android:icon="#mipmap/launcher_icon">
<activity
android:name=".MainActivity"
android:exported="true"
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"
/>
<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>
If you work with a real device, your phone and your laptop have to be connected to the same internet. This is solution for me. Dont't forget add " "
at ./android/app/src/main/AndroidManifest.xml
Deployed Flutter application to Google Play Store but it's stuck at the splash screen and never open
I did match my AppID and still facing the same issue
Here is my manifest.xml:
<!-- TODO: Changed by Parveen Before merge 1 -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mrbox.store">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--
io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here.
-->
<!-- TODO: Add By Parveen before merge 1 -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Mr.Box Store"
android:usesCleartextTraffic="true"
android:icon="#mipmap/launcher_icon">
<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>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!--
TODO: Changed by parveen before merge 1
android:name="default-url"
android:value="https://inspireui.com"
-->
<meta-data
android:name="default-url"
android:value="https://www.mrboxstore.com" />
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- TODO: Changed by parveen before merge 1 android:value="inspireui.com" -->
<data android:scheme="https"
android:host="mrboxstore.com" />
<data android:scheme="http" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#drawable/logo" />
<!--
Set color used with incoming notification messages. This is used when no color is set for the incoming
notification message.
-->
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="#color/notiColor" />
<!-- Google map and Admod setup -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/api_key" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="#string/admob_api" />
<!-- Facebook Login configuration -->
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:exported="true" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</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>
Things to try
Make sure flutter doctor -v runs without ANY complaints
Edit android/gradle.properties and add the flag: android.bundle.enableUncompressedNativeLibs=false
Do a flutter clean command
Try creating a release build using flutter build appbundle
Test Locally / Offline
download bundletool
Generate a set of APKs from your app bundle, following this guide
Deploy the app to your connected device(s) following this Guide
Works?
Upload your bundle to Google Play using the internal test track, or the alpha or beta channels to test the bundle before releasing it in production
Instructions for doing this can be found here
Good Luck :)
Because it is not working after uploading on google play. then there might be some issue with your app signing. You can follow the steps here
I have faced issues like this when I used facebook login sdk, so I would suggest checking following:
Check if you have signed the apk/appbundle with proper release keystore
Check if you have opt in for google's automatic signing on playstore while deploying app
2.1 If yes then it will change the sha-1 value which is used in facebook app for authentication, for it to work use the one generated by google in playstore
Assuming that you publish an App Bundle (.aab file) the issue can be related to the format itself since it is not testable via IDE. E.g. when running the app in Release mode on a device .apk is created and provisioned to it, not .aab.
What I did in the past to troubleshoot .aab (also had failures only with GPlay version, local Debug and Release modes worked fine) was to use Firebase Test Lab. You can run automated monkey tests on 5 physical devices and 15 virtual devices every day free-of-charge. Just log in to Firebase Console, cretae an empty project, go to Test, upload your .aab file, select devices (it's worth also to choose different locales) and wait for completion. After that check logs in test results, you might find answers there (in my cases there was an issue with localization resources which got broken while producing .aab release package).
This option can be esier/faster than splitting .aab locally with comand line into APKs and testing on a local device.
In my experience, try to check your database(sqlite) if created. Try to replace the path and check if the database is created properly.
I'm develop application with unity and vuforia and I use
<meta-data android:name=“unityplayer.SkipPermissionsDialog” android:value=“true”>
in Manifest.xml to skip permission on startup.My application export (apk) in unity 5.1.1 work fine but not working in untiy 2018.3.14.I'm going to create another project with unity 2018.3.14 and edit the manifest.xml with line on above, but it still ask for camera permission on startup.
This is my manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="preferExternal">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="26" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:theme="#style/UnityThemeSelector"
android:icon="#mipmap/app_icon"
android:label="#string/app_name">
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="#string/app_name"
android:hardwareAccelerated="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<!-- For Runtime Permission -->
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />
<activity android:name="com.onevcat.uniwebview.UniWebViewFileChooserActivity" />
</application>
</manifest>
Any help please?
First guess
Unity won‘t ask for permission directly after the app start anymore, if you set unityplayer.SkipPermissionsDialog.
But Vuforia will do request a runtime permission dynamically the moment it an AR Camera is enabled.
I‘m guessing that you are using an AR Camera in you first scene?
update 1
Try moving unityplayer.SkipPermissionsDialog in the AndroidManifest.xml inside the activity tag instead of the application tag.
So, I try another way to solve problem.
1- Check the Delayed Initialization box (Window->Vuforia Configuration).
2- Use the <meta-data android:name=“unityplayer.SkipPermissionsDialog” android:value=“true”> normally and ask for permissions when I need those.
3- Add this line of code to the Start() function of this new script and assign it to empty gameobject:
VuforiaRuntime.Instance.InitVuforia();
4- So, when user allow for permission, I load 2nd Scene and it run Vuforia initialize.
I want to select a image from my android emulator and then upload it to cloud storage. When I call File image = await ImagePicker.pickImage(source: ImageSource.gallery); I get error as follows:
MissingPluginException(No implementation found for method requestPermissions on channel flutter.baseflow.com/permissions/methods)
I tried to put camera permission in AndroidManifest.xml file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.somethingdwun.dwun">
<uses-permission android:name="android.permission.CAMERA" />
<application
android:name="io.flutter.app.FlutterApplication"
android:icon="#mipmap/ic_launcher"
android:label="dwun">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in #style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"/>
</application>
</manifest>
Thanks
And i found thisMissingPluginException
No need to add permissions in AndroidManifest.xml file. Close your app, go in project directory & try running this in command line:
flutter clean
I think it will solve your problem
Did you add that in to your dependency?
First, add image_picker as a dependency in your pubspec.yaml file.
Hope it will helps you
dependencies: image_picker: ^0.6.2+3
sometime hot restart or hot reload won't do the trick.
make sure you add image_picker as a dependency in your pubspec.yaml file
Close the app and execute flutter run command.