Flutter google map on release mode not work - android

hi to all flutter developer
my question: when I use flutter google map and when I build final and release app for android the map is not working
how I can fix this problem
please look at below image

Problem resolved, I must enter the SHA-1 when i creating API key

You have to write flutter command screen 'flutter upgrade'. Maybe it help you to solve your issue.

After a very long search and mainly thanks to the help of Ruslanbek0809 I solved this problem at last.
In android/app/build.gradle I added:
shrinkResources false and minifyEnabled false to the buildTypes
buildTypes {
release {
signingConfig signingConfigs.release
shrinkResources false
minifyEnabled false
}
}
And a miracle happened

Related

Android Release build can be attached

I recently find my Android Release version can be attached through Android Studio and all logs are available to be seen as well, even though I'm sure that AndroidManifest.xml file doesn't contain "android:debuggable=true" and app's build.gradle file specified that
buildTypes {
...
release {
...
debuggable false
...
}
...
}
Do you guys have any good idea to avoid this?
You can only keep like this code below:
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
hopefully works it.
Logs are nothing to do with debuggable true.
The option debuggale is to making your application debuggable in release mode, so you can attach debugger even on your release build by default it is false.
If you are using Log class and printing any log it will always display until and unless you put the check before logging them.
What you can do is put a check before every log is Build.Debug == true then print the log.
Or you can use open source library for this work like this one which provide the control of logging based on your configuration.
Or you can find a more helpful answer here.

Android Images are not displayed after release build or if i instant run turn off

I am getting images id from drawable-hdpi at run time using getIdentifier method using following code
mContext.getResources().getIdentifier(mContext.getPackageName() + ":drawable/" + mCur.getString(mCur.getColumnIndex(Constant.COLUMN_IMAGE_DRAWABLE)), null, null)
i also tried following ways
mContext.getResources().getIdentifier(mCur.getString(mCur.getColumnIndex(Constant.COLUMN_IMAGE_DRAWABLE))+"", "drawable", mContext.getPackageName());
and set image resource using following code
imgPosotion.setImageResource(item.getDrawable());
both work when i turn on instant run from android studio but unfortunately none of them work when i am turn off instant run feature from android studio.
I am using Proguard at debug as well as release time using following code
release {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
Observed scenario
Image are not showing. Code run perfect and showing images when run with instant run.
i make release build and then decompile it, i observed that images(.png extension) are there in res/drawable-hdpi folder but sizes are converted into 1*1 dimension(67byte) and when i tried to open just a dot are visible and when i tried to open jpg(converted to 0byte size) files they are not opened.
Expected scenario
Image must be visible
Action taken to solved
Make the image size small
convert images into from .png to jpg
I stuck to this problem so please help me. Appreciate, if anyone can help to troubleshoot.
nobody takes this question seriously but after do lots of type stuff i got the solution. Actually problem was with proguard, i don't known why but it works after set false to shrinkResources
release {
..
minifyEnabled true
shrinkResources false
}
It`s the bad practce, you should use official google strategy as described here https://developer.android.com/studio/build/shrink-code#keep-resources
release {
..
minifyEnabled true
shrinkResources false
}
worked fr me

Cannot see Firebase upload mapping file task

Uploading mapping file with command:
./gradlew -PFirebaseServiceAccountFilePath=<path> \
:app:firebaseUploadFreeReleaseProguardMapping
Runs successfully but i cannot see any tasks starting withfirebaseUpload in my app:tasks. Do somebody know why?
We also have encountered this problem.
Solution is to add minifyEnabled in your apps build.gradle like so:
buildTypes {
release {
...
minifyEnabled true
...
}
}
And sync your project, then you will have those tasks created.
#MatBos thanks for the hint. This didn't solve the problem for me.
But I had this cause:
buildTypes {
debug {
minifyEnabled true
useProguard false
}
}
When I change minifyEnabled to false it is working again!
Disabling proguard in debug mode, disabled also the firebase tasks for the production code...
You can upload mapping files manually too.
Go to destination.
app/build/outputs/mapping/debug/mapping.txt
And then upload it.

You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play-Upload apk to google play

I Want to upload my apk to google play store.but its Show me error like this.
**You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play**
and than i searched for this and i receive suggetion to change the android:debuggable="false" in manifast.xml.
I changed like this
manifast.xml
<application
android:allowBackup="true"
android:debuggable="false"
android:icon="#mipmap/ic_launcher"
android:label="Concall"
android:screenOrientation="portrait"
android:theme="#style/AppTheme" >
and in my build.grable(Module)
android {
buildTypes {
debug {
debuggable false
}
}
1.is the enough for upload Apk to google play store?
2.if i pick up apk from my project folder(app>>build>>output>>apk>>apk-debug.apk) after this change than after it will able to upload in google play store??
Don't use the debug variant output! Build a release apk. You can do that in Android Studio by going to the menu Build -> Generate Signed APK. Or by executing ./gradlew assembleRelease if you have properly configured signing in the build file.
I ran into this error and my application did not reference debuggable anywhere. After a little bit of searching, I found that I accidentally had testCoverageEnabled true in my release build type.
release {
testCoverageEnabled true
...
}
Removing this resolved the issue.
In my build.gradle file, I had debuggable = false and I was wondering why I'm getting this issue. later I found that it was debuggable = true in my AndroidManifest.xml file's application tag
I was having the same problem. Unknowingly I kept
debuggable true in release buildType
buildTypes {
release {
minifyEnabled false
shrinkResources false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
After changed to false. Its working fine.
buildTypes {
release {
minifyEnabled true
shrinkResources true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
This should be the flags for uploading the Apk to Playstore. Not needed to be release build. If you want to test your qa build, you can do ./gradlew assembleQa
with flags
minifyEnabled true
debuggable false
shrinkResources true
testCoverageEnabled = false
This feature can be controlled from the manifest file also, disable from there
android:debuggable="false
I was getting this warning when I wasn't selecting the "Signed" version.In the signed version, select release to deploy.
.

android debugger does not stop at breakpoints

I am seeing debug statements in the console but the debugger does not stop on any breakpoints. I tried clearing all breakpoints and adding them back in. Not sure how this can happen but it is.
Solution that worked for me:
Simply uninstall the app from the device (manually on the device) and try debugging again(!)
If you use Android studio, click debug app instead of run app:
According to this answer, Inside build.gradle for your app module, disable minifyEnable for your build variant and change it to false. Then, it should be:
minifyEnabled false
othewise you will see Line number not available in class xxxx when you hover over breakpoint markers and they will be looked with a cross on them
Have you set the debuggable flag in the AndroidManifest?
If you miss that, do so by adding android:debuggable="true" in the application tag.
It should look like that in the end:
<application android:icon="#drawable/icon" android:label="#string/app_name" android:debuggable="true">
In my case, click the "Attach debugger to Android process"
And it will shows a window said "Choose Process"
Select the device you are using, and select the project that you want to debug. And it works.
Sometimes the debugger need to re-attach to the devices when you open the debugger at the first time.
For Android Studio:
Check if the option Mute Breakpoints is enabled by mistake. The icon looks like this:
For Eclipse:
Check if the option "Skip All Breakpoints" is enabled by mistake. It is the last icon on the following toolbar
Did you do "Debug As --> Android Application" instead of "Run As"?
Only if you do "Debug As", eclipse will stop at breakpoints.
I had the same problem.
Go to build.gradle.
You must change this code if you have one.
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
The debug section should look like this:
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
I hope your problem is solved
if you have added some build type in build.gradle check to have debuggable true
buildTypes {
debug {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
In my case, the app created a service with a different process with android:process=":service" in the AndroidManifest. So I was setting breakpoints in the service process code while the debugger is automatically attached to the main app process. Pretty stupid of me but it might help someone else.
You attach to the service process with Run > Attach Debugger To Android Process and choose the service process. You might need to add android.os.Debug.waitForDebugger(); to your service process code if you can't attach in time manually.
As far as I know, there's no way to automatically tell Android Studio or IntelliJ to attach to a different process before running.
i had this problem i clean buildTypes part of build.gradle
and try age so it work me.
If you are finding this issue while using the Flutter plugin, you can try updating the plugin to version >65.1.3 as specified in this article
None of the valid answers above worked for me. In my case there was another app still in the background that I had launched some time earlier via Android Studio. So not the same App/PackageId, but another. After closing that app I got hits on breakpoints via wifi debugging.
I had the same issue and resolved it by increasing the debugger timeout values.
The emulator is slow as a dog on my Dev box and that is what prevented the debugger to catch and stop on breakpoints.
I changed the timeout values respectively from 3000 to 10000 and 20000 to 60000 and all is fine now.
V.

Categories

Resources