Cannot debug application com.domain.test on device samsung-gt_i9300-323020cfc86b804f.
This application does not have the debuggable attribute enabled in its manifest.
If you have manually set it in the manifest, then remove it and let the IDE automatically assign it.
If you are using Gradle, make sure that your current variant is debuggable.
Your comment has already hinted the answer to this post but since you have not selected an answer I'll write it down.
Change build variant from release to debug from android studio left corner.
A right solution is written in https://stackoverflow.com/a/25628789/2914140:
open build.gradle of your module, type: 'debuggable true' (an example is below):
buildTypes {
release {
signingConfig signingConfigs.release
debuggable true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
applicationIdSuffix ".debug"
debuggable true
}
}
When you generate a signed APK from menu, you should edit 'release' branch changing 'debuggable true' to false in order to avoid a debuggable information.
In build.gradle
debug {
debuggable true
signingConfig signingConfigs.debug
}
for whose came here searching TS's quote, check if you set Android Application in Run/Debug configuration popup. Not Native, like in my mistake.
Related
Hi I cannot found any answer solution for this
I have follwoing custom variant in \android\app\build.gradle
I have tried put debuggable false
But this does not changed __DEV__ to false.
Everyone is telling debug variant and release variant but nobody is telling how exactly a specific toggle to change __DEV__ to false.
Please help thanks.
buildTypes {
alpha {
signingConfig signingConfigs.dev
debuggable false
...
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
matchingFallbacks = ['release', 'debug']
}
}
also I have tried removed 'debug' from matchingFallbacks not working as well.
matchingFallbacks = ['release']
If im not mistaking you are looking at it wrong. As the link below mentions.
You can use the DEV global variable in JavaScript to determine if you're using React Native packager or not. If you are running your app in the iOS Simulator or Android emulator DEV will be set to true.
React Native DEV and PROD variables
As long as your running the app on emulators the __DEV__ variable will be true.
You can try to run in a simulator with --configuration Release
I'm experiencing this problem too, in my case the buildType name should contain "release" keyword. (don't ask me why)
Change alpha to alphaRelease and everything should works fine.
Example:
(I'm using RN 0.68.2)
buildTypes {
debug {
signingConfig signingConfigs.debug
debuggable true
applicationIdSuffix ".dev"
}
alphaRelease {
initWith release
matchingFallbacks = ['release']
signingConfig signingConfigs.hmg
debuggable false
applicationIdSuffix ".hmg"
}
release {
/* Add the firebaseCrashlytics extension (by default, it's disabled to improve build speeds) and set
* nativeSymbolUploadEnabled to true along with a pointer to native libs. */
firebaseCrashlytics {
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
}
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
debuggable false
applicationIdSuffix ""
}
}
I'm building release APK with flutter run --release but I'm getting this exception
Failed to register native method io.flutter.view.FlutterNativeView.nativeRunBundleAndSource(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V in /data/app/com.example.myapp-1/base.apk
However, debug variant runs normally so if I run the app just with flutter run everything is fine.
By the way, I'm executing flutter clean before avery build.
What is the cause of this?
Found the solution on my own, but I'm posting this answer for people who are having the same problem.
Turns out that build.gradle was causing exception
shrinkResources true // for this to work minifyEnabled must be set to true
minifyEnabled true // if set to true apk will not build
Solved it by using only proGuard so snippet below is working buildTypes section of app-level build.gradle
buildTypes {
release {
debuggable false
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
We need to have gradle.properties files with different configs for release and debug builds, because some of the features we use are experimental and they break some things. Is that possible?
Example of our gradle.properties file
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx1500m -XX:MaxPermSize=512m
org.gradle.parallel=true
kotlin.incremental=true
android.enableD8=true
As per official document:
You can create and configure build types in the module-level build.gradle file inside the android block. When you create a new module, Android Studio automatically creates the debug and release build types for you. Although the debug build type doesn't appear in the build configuration file, Android Studio configures it with debuggable true. This allows you to debug the app on secure Android devices and configures APK signing with a generic debug keystore.
You can add the debug build type to your configuration if you want to add or change certain settings. The following sample specifies an applicationIdSuffix for the debug build type, and configures a "staging" build type that is initialized using settings from the debug build type.
You can use same build.gradle for release and debug modes like:
buildTypes {
release {
// Do whatever you want to do in release mode
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
// Do whatever you want to do in debug mode
applicationIdSuffix ".debug"
debuggable true
}
/**
* The `initWith` property allows you to copy configurations from other build types,
* then configure just the settings you want to change. This one copies the debug build
* type, and then changes the manifest placeholder and application ID.
*/
staging {
initWith debug
manifestPlaceholders = [hostName:"internal.example.com"]
applicationIdSuffix ".debugStaging"
}
}
Ref: Source
buildTypes {
release {
shrinkResources true
minifyEnabled true
debuggable false
signingConfig signingConfigs.releaseConfig
}
debug1 {
debuggable true
signingConfig signingConfigs.debug
}
debug2 {
debuggable true
signingConfig signingConfigs.debug
}
}
You came different build variants like above and on Android studios select the build variants option(usually in the bottom left corner). select which variant you want to build the apk and run the app.
I am obtaining that BuildConfig.BUILD_TYPE returns always "release", even if I am compiling it in debug mode.
I include here a part of my build.gradle:
buildTypes {
debug {
debuggable true
minifyEnabled false
}
release {
debuggable false
minifyEnabled false
//md5 sign certificate split in two
proguardFile './dexguard-config/dexguard-release-conservative.pro'
//proguardFile getDefaultDexGuardFile('dexguard-release-aggressive.pro')
proguardFile 'dexguard-project.txt'
}
Thank you!
Make sure you are importing BuildConfig of your own module, with the package name from its AndroidManifest.xml.
Other modules' BuildConfigs might be hardwired to release.
Check your option in Build Variants in Android Studio.
PS: You can also run your release APK in debug mode.
For some reason I have to run my Android App in release mode.I have to run through the code when running the app just like we use in debug mode. My break points are not hitting when I run in release mode, I have added android:debuggable="true" in manifest. Still the breakpoint is not hitting. Any help.
Thanks in Advance
In your gradle file, you must add debuggable ability in your release flavor.
buildTypes {
release {
debuggable true
minifyEnabled false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
debuggable true
minifyEnabled false
applicationIdSuffix '.debug'
}
}
signingConfig is release configuration it must be added in gradle file in android{} block, something like this:
signingConfigs {
release {
keyAlias 'YourAppKey'
keyPassword 'somePassword'
storeFile file('appkeyfile.jks')
storePassword 'somePassword'
}
}
In my case, I have created the debug configuration same as previous release build and started debugging. It means you have to give sign build in debug version also in build gradle.
signingConfigs {
config {
keyAlias 'abc'
keyPassword 'xyz'
storeFile file('<<KEYSTORE-PATH>>.keystore')
storePassword 'password'
}
}
buildTypes {
debug {
debuggable true
signingConfig signingConfigs.config
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
So It will have the same sign as release build and you can debug when it runs.
buildTypes {
release {
debuggable true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
happy coding.Mark this answer up..if it helps.. :)
Few pennys for the new comers.
If even After adding debuggable true in release block, your debug points are not hit.
Remove the following code from the release block.
minifyEnabled true
shrinkResources true //remove resources
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
There's no "release mode". What you refer to is the build type which means steps taken during building (like minifying etc). Setting android:debuggable="true" will not automagically help, because when you "Run" the app instead of "Debug" you do not connect debugger to it so it will not stop for that particular reason.
So you can
set up your Debug build to be produced the same way Release
is
But is quite unclear what is the reasoning behind your need and I got a feeling you are trying to go the wrong way (i.e. debug is usually not using ProGuard, while release build is and ProGuard changes the resulting binary so your breakpoints from source will not really work anyway).
I think Marcin's argument above makes sense (much as there are situations that require debugging release builds), so here is a slight variation of the accepted answers that worked for me:
android {
...
buildTypes {
release {
shrinkResources false # this was key
minifyEnabled false # seems that it can't be set to true if shrinkResources is false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
Adapted from the official docs
NOTE:
When I set minifyEnabled true, the following crash occurred on app launch:
java.lang.RuntimeException: Unable to instantiate application co.mycompany.app.MyApp: java.lang.ClassNotFoundException: Didn't find class "co.mycompany.app.MyApp" on path: DexPathList...
In 2022, or at least in MY case
I tried many solutions but didnt work finally solution was to create a new siginig key and use it with all build types &variants.
Steps
1 - Go to AndroidStudio top menu select Build>Generate Signed Bundle /APK > (choose APK )
*for the first time create a new key (you know how to create one? or read docs )
BUT NOTE while you are creating key choose build type debug then continue
2 - Again Go to AndroidStudio top menu select Build > Generate Signed Bundle /APK > (choose APK) BUT this time choose existing key ( the one we made in previouse step)
in previouse step we chose build type debug this time choose release and continue..
3 - Repeat steps 1 & 2, with AAB (release & debug)
this is basically making sure all build types are being signed using same configs.
NOTE
maybe you need to add below code to app build.gradle
android {
...
signingConfigs { <-- Add this
config {
storeFile file('PATH_TO_KEY.jks')
storePassword 'YOUR PASSWORD'
keyAlias 'YOUR KEY ALIAS'
keyPassword 'YOUR PASSWORD'
}
}
...
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config <-- this
}
debug {
signingConfig signingConfigs.config <-- this
}
}
}