I want to get location updates in background when app is minimized. So I created a demo Flutter application with a service in native Android which I can run in foreground to get the continuous location updates for application and it is working fine as my expectation it is updating locations in notifications (for test).
Then I tried to implement same service with actual Flutter application with same service mentioned in manifest file same as demo application but my application is crashing on starting so I can't debug and in addition to that I don't get any error in building.
My main Flutter application is working fine without the location service implementation so only issues is after implementation it causes crashing.
What could be the issue and solution for this problem or how can I find out what is the problem?
I am doing same thing in original Flutter application same as in this dart code of demo application. How can I investigate this problem?
I am adding my answer regarding the question mentioned above.
in my case, it was not a foreground service which was crashing application but the issue was that As the flutter is growing framework, We get lot of updates & changes. With one of those Flutter update, Flutter updated plugin registration process for app on native side so some plugin with older version dependencies doesn't get registered with app as flutter doesn't support FlutterView(deprecated) anymore.
Note: Always make sure your plugin dependencies are updated to latest version of its dependencies in pubspec.yaml.
For me, My main application and demo application created for foreground was working according to my expectation but when I merge them it was crashing because camera plugin dependency version was too old. Second thing you can do is which can also reduce chances of error due to androidx compatibilty as well. Though, it is not too tough to do in old app as well.
Note : Create new flutter project and move your all dart code to new application.
Please be careful while doing this option.
-- Don't forget to add permissions in manifest files which you are accessing in app.
-- Don't forget to add assets and resources used on native side if you have added or changed.
-- Don't forget to set version according to version of old app.
-- Don't forget to make changes in your gradle files if any of app dependencies use that configurations like minimum sdk, targetSdk, etc... (if it applies in your case)
If you don't find this useful you can run your android side code in android studio and can find out what is the problem by debugging that code and fix it. Thanks
Related
I am developing an app in flutter and I want to use an SDK which isn't available for flutter and they have a sample project which is written in java (android native) and I want to integrate that app to my current flutter app, is that possible to be done with platform channels?
My experience in the android native is very weak so I almost can pick up with that project.
Thanks in advance,
Yes, you can. It's your own app though, not another one. And it's not necessary, but Android Studio will help you.
You have to modify the /android project of your Flutter project. You need to implement the SDK in question, and copy/paste/refactor the relevant sample code. You can then expose this code to the Flutter side via a method channel. To learn how, read this doc.
Important : Hot Restart will not update native code. You have to recompile everytime you want to apply native code changes.
I have tried every tip to solve this problem but it simply do not work. The problem accured after update of android studio to 3.01 + gradle. I have older dependencies and gradle + android studio on my laptop and it works without any problem. I just want get access to Android device monitor to look up into my sqlite database files.
I tried simply kill, restart adb process, use different port then 8701, edit host file but without any progress into resolving this issue.
Everything except Device monitor works fine. I am able to launch application on emulator and actual phone. Maybe someone met this issue after updating program and have some sort of magic solution.
Found a problem earlier but forgot to post it here. It appears to be a issue with platform level 24 and above. You need to work on level 23 in order to use android device monitor.
I have an application on the Play Store, which I update regularly with android tools update and dependencies update but that's it.
I just ensure it compile and work with the latest Android platform and support libraries.
I don't add any features or anything.
Recently I've been received a lot of crash on ActivityThread.java with the message:
Fatal Exception: android.app.RemoteServiceException
Bad notification posted from package xxx.xxx.xxx: Couldn't create icon: StatusBarIcon(pkg=gxxx.xxx.xxxsuser=0 id=0x7f03002d level=0 visible=true num=0 )
My application do receive notification, I use the intercom SDK for that, which is registered like so
Intercom.client().setupGCM(token, R.mipmap.notification_icon);
Basically I don't intercept the notification myself, I just use an AsyncTask to request the GCM token and that's it.
Now it appears that every time the production app receive notifications, it silently fail to create the notification and crash the app, as per the report I got.
Prior to an Android 3.0 and compileSDK 26 build, I didn't had this issue.
I didn't change nor the code which handle notifications, nor the Intercom SDK version.
Did I mention I can't myself replicate the issue, with both a debug and production build on my phone, I can receive notification just fine.
But I got a lot of those crashes in the wild like a lot. As you can except when thousands of notifications are sent to the same app.
But it seems to be concentrated on Samsung phone with Android 7. But not only.
I guess and I hope I'm not the only one having this issue, I bet there is something that have changed in the APK generation or the support libraries I'm not aware of. If you have any clues, it would be welcome.
AS 3.0 uses new gradle version. In my app I have the same issue. It's caused by new resource IDs. If you compare R.java files, generated by different gradle versions, you can see that same resources have different IDs. In my case, I use DevToDev SDK to receive push messages. I initialize SDK and pass resources used in notifications in MainActivity, obviously, if user will not start app after update, there will be old IDs for recources used in notification. This causes app to crash. I haven't solved my issue yet, the only way I can offer you to solve it is to use BroadcastReceiver to catch app update event
<receiver android:name=".AppUpdateBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
</intent-filter>
</receiver>
and to initialize your SDK there.
If you want to replacate this issue, you can try to do these steps:
Install old version of app, launch it and make sure that notifications are working properly
Disable auto launching after installing apk from AS
Install new version of app (built with new gradle version), but do not launch it
Send test notification to your device
I have a Processing sketch that works fine on my computer.
I'm now trying to get it running on my Android tablet using Processing Android mode. But I'm getting a lot of compiler errors saying "cannot find symbol".
I'm using some Processing libraries I've created using https://github.com/processing/processing-library-template .
These libraries don't actually access system resources or call the Processing library themselves. Or any other external Java except Java.util. They're just manipulating data-structures.
However it seems Android mode has a problem with them.
Googling around it seems that a lot of Processing libraries don't work with Android Mode, but I can't find anything explicit : should I simply assume that external libraries can't work at all with Android mode? Or are there specific things that won't work? Or should I be looking for a specific bug somewhere in my code?
Update : Further details. I believe Processing Android mode targets Android 2.3.3. I'm using Processing 2.21. The libraries I'm talking about are my own.
From a related Git Issue page , a comment by omerjerk
The master branch of this repository is not buildable with the master
branch of processing. processing has moved ahead and we haven't
updated this repository yet. Why are you really building the Android
mode yourself ? If you want to run your processing sketches on your
phone, then just download processing 2.2.1 from the main website, open
the IDE and from there, download the Android mode. In case, if you
really want to build Android mode from source, apply this pull request
- #98 .
See if this helps
My project working perfect but i need map implementation and I add google play service library. After that whenever i run project my GC stopped working and eclipsed hanged. I closed eclipse and i removed google play service library and now my project working fine.
This strange but it's really happening. I also update my google play service library. But updated library also not working.
Two error dialog I am getting when try to run my project
I tried it approx 3 times by removing and adding library but same problem.
EDIT : I also try this library with my previous map sample project but now its also not working.