Flutter app freeze in build release, work properly in debug, androidX? - dart

final update:
now everything works;
while before I was not adding internet permission and the app worked perfectly
(contacting API and everything), since the update I have to explicitly modify the manifest.
Easy fix actually:
manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxx"> <uses-permission
android:name="android.permission.INTERNET"/> <application
android:name="io.flutter.app.FlutterApplication" android:label="xxx"
android:icon="#mipmap/ic_launcher"> <activity android:name=".MainActivity"
[...]
if you are too experiencing the same unexpected changes of behavior in your app.
This might be the cause.
Thank you for your attention.
[update 19/3/2019]:
Facebook user "Momo Roro" described a similar behavior of its own app
asserting that it was caused by the inability of the app
to contact the API, it actually matches my situation,
in fact right after the splash screen my stream should receive
data from an API and route to a specific screen accordingly.
Any idea why it works in debug and not in release build?
I'm iterating an app I'm working on from a while;
I had several release version,
but after updating to flutter
(I curse myself every day for that)
the app works perfectly in debug, but freeze in release build
(although it loads the 'homemade' splash screen)
no errors in compile time,
flutter doctor says ok,
I've pin my dependencies and added this to
prevent androidX issues
rootProject.allprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core') {
details.useVersion "1.0.1"
}
if (details.requested.group == 'androidx.lifecycle') {
details.useVersion "2.0.0"
}
if (details.requested.group == 'androidx.versionedparcelable') {
details.useVersion "1.0.0"
}
}
}
}
I've tried: flutter clean,
flutter build apk --target-platform=android-arm64,
flutter build --release... nothing works
I opened an issue on github, but
I would appreciate if you could point me in the right direction
here you can find some logs
thanks in advance

final update:
now everything works;
while before I was not adding internet permission and the app worked perfectly
(contacting API and everything), since the update I have to explicitly modify the manifest.
Easy fix actually:
manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxx">
android:name="android.permission.INTERNET"/>
android:name="io.flutter.app.FlutterApplication" android:label="xxx"
android:icon="#mipmap/ic_launcher">
[...]
if you are too experiencing the same unexpected changes of behavior in your app.
This might be the cause.
Thank you for your attention.

Just this week I had a similar problem that had nothing to do with app permissions but rather the gradle configuration.
I tried different suggestions but what worked for me was downgrading my gradle dependency from 4.1.2 to 3.5.4
Go to android/build.gradle (not android/app/...)
from dependencies, change your gradle version from classpath 'com.android.tools.build:gradle:4.1.2' or any higher version you are using to classpath 'com.android.tools.build:gradle:3.5.4'

Related

Flutter beacons_plugin - Unhandled Exception: MissingPluginException(No implementation found for method startMonitoring on channel beacons_plugin)

I've run into this situation: the plugin and my code ran perfectly in Android, but in iOS these errors happened:
(Screenshot - my reputation is too low to post images. For easy reading I took the screenshot of VSCode debug console; the errors were the same while run it from Xcode)
https://user-images.githubusercontent.com/10349431/94634472-b2d42e80-0302-11eb-9dc7-fa2956511b82.png
It shows in the debug screenshot above exceptions took place while invoking method startMonitoring, but after I commented related codes it turned into other methods (e.g. stopMonitoring, addRegion, etc).
(BTW, the error messages may be as many as hundreds of lines - in the screenshot above, there were actually 381 lines of total error messages.)
My environment:
MacOS 10.15.7
iOS 12.4.8 (iPad) 13.3 (iPhone)
Android 8.0.0
Xcode 12.0.1 (12A7300)
VSCode 1.49.2
Android Studio 4.0.1 with all SDK after Android 5.1 Lollipop
Thanks for any help!
I got it... In this case, BeaconsPlugin.listenToBeacons should not be placed below addRegion or startMonitoring/stopMonitoring. It should be in the first line of all actions of this plugin in the initPlatformState scope, just like it has been in the example.
Sorry for dumb question.
This error mostly occurs when you try to Hot Reload or Hot Restart after just adding new package to your pubspec.yaml.
Just stop the running project(app) and then freshly run it again. So that the added package(which contains the implementations) also pushed to the device
please check : https://stackoverflow.com/a/60088062/11989529
and this : MissingPluginException while using plugin for flutter
the same problem

EarlGrey launches APP with black screen

After successfully adding EarlGrey to existing project (using CocoaPods) project is successfully built (both "for running" and "for testing"). The problem is that if I run the app from XCode it runs as expected. If I run it as a test only splash screen appears and then whole screen turns black. Have anyone encountered such issue? What might be a problem here?
There is somewhat similar question Black screen with EarlGrey but author did not share his solution.
Additional info:
XCode 8
CocoaPods 1.2.1
EarlGrey 1.9.3
I followed #khandpur advice and tried debugging my app first. So I found out, that in main.m file we're checking if current run is a test run, by
BOOL areWeRunningTests = NSClassFromString(#"XCTestCase") != nil;
Based on that we are running app differently.
To everyone in similar situation: I've added a check
BOOL areWeRunningUITests = NSClassFromString(#"EarlGreyImpl") != nil;
and if that's true app is starting normally.
Final comments - you have to know your app a little to be able to use EarlGrey easily... :)

ADAL Cordova Plugin unable to retain token on ios

I'm still a newbie in the mobile app development arena, please forgive me if I did not provide adequate information, probably because my lack of knowledge on its relevance. I'll edit with more info upon request.
Here's what I'm using to build my app on a Windows 7 64bit environment:
AngularJS 1.0
Phonegap Build 6.3.0 (cloud version)
cordova-android 5.2.1 (as shown on Phonegap build)
cordova-ios 4.2.0 (as shown on Phonegap build)
azure-activedirectory-library-for-cordova version 0.7.1
I'm testing on:
Android phone Samsung Galaxy SCH-I545 os version 5.0.1
iPhone 6S Plus os version 9.3.5
Everything went well with Android using ADAL plugin 0.7.1. However on iPhone, it kept going back to the login screen for authentication to our AD FS even though I already got authenticated the first time. I'm suspecting the token did not get stored in cache, that's why acquireTokenAsync kept getting called? I'm still trying to get my hands on a MAC to troubleshoot further.
Then, I updated to ADAL plugin 0.8.0 to see if that might solve my problem, but now Android stopped working and I got this error:
DEVELOPER_AUTHORITY_IS_NOT_VALID_INSTANCE
I debugged through using developer tool on both 0.7.1 and 0.8.0 and I saw no token coming back in acquireTokenAsync method in version 0.8.0. Switching back to 0.7.1 and Android works again.
Could anyone guide me on what might be causing this problem on my iPhone and Android? Maybe I'm missing additional settings or files? The way I updated the ADAL plugin was replacing the cordova-plugin-ms-adal folder under plugins and modify my config.xml file to spec="~0.8.0", that should be sufficient right?
* Update on cordova-android *
I finally got 0.8.0 working on my android device by turning off validateAuthority
var context = new Microsoft.ADAL.AuthenticationContext(authority,false);
I think it's because I'm using AD FS (found this comment in ADErrorCodes.h under adal-for-objc):
/*! The passed in authority URL does not pass validation, if you're trying to use ADFS directly you must disable authority validation. */
/*! An error was raised during the process of validating the authorization authority. */
AD_ERROR_DEVELOPER_AUTHORITY_VALIDATION = 101
* Update on cordova-ios *
Debugging in Safari developer tool, I don't have tokenCacheItems after the native method got called.
bridge.executeNativeMethod('tokenCacheReadItems',[this.authContext.authority, this.authContext.validateAuthority])
.then(function (tokenCacheItems) {
tokenCacheItems.forEach(function (item) {
result.push(new TokenCacheItem(item));
});
d.resolve(result);
}, function(err) {
d.reject(err);
});
I spent almost a week on this already and I really appreciate any help on this issue.

webrtcjingle disconnect crash on ios Lukeweber version

I just downloaded the lukeweber version of webrtcjingle, which I believe is just a branch of the google one.
I change the server and account setting on the demo and run it. It was able to log in and send/receive messages. However, When I tried to logout. The app crash.
I had a little debug on it, and found out the line of code that crash was in file txmppump.cc, function:
void TXmppPump::WakeTasks() {
talk_base::Thread::Current()->Post(this);
}
Does anyone have an idea what the problem is? I noticed that there is a fix on disconnecting problem issued caused by a race problem on the repo:
github bug list
However, I compared my code to the fixed version. They are the same. So I dont know if they are related or not.

PhoneGap + Sencha2 screen blank

I've started a project in PhoneGap which will utilise Sencha Touch 2.
I tried to change the app name from 'app', since I've heard that conflicts with PhoneGap on Android devices. I altered app.js to main.js and that worked, but then I tried changing the Ext.application.name. All I got was a white screen after the loading splash, even with the old name Sencha. Debug console shows nothing at all happening, and the document <body> was empty. This happens with both sencha-touch-all.js and sencha-touch-all-debug.js. Test device is an iPad 1G running iOS 4.3.5.
Aside: To debug this issue, I set up weinre on my Mac and added the appropriate <script> tag to index.html. After making that change, though, the app didn't even launch. It hung on the PhoneGap splash png and I got this message from gdb-remote:
error: failed to launch '<app URI>' -- failed to send the qLaunchSuccess packet
The only reference to that message besides its definition in gdb-remote source that I can find is here, and it's unrelated. I managed to get the issue to go away by restarting the iPad and removing build intermediates.
SOLVED: The issue here was a missing value in the Ext.application definition (key with no associated value), so the whole app definition probably tanked as a result of that. Hence blank screen.

Resources