debuggable false in android studio 0.4.5 - android

<application
android:debuggable="false"
get a error saying "Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one"
I deleted what is up in AndroidManifest and I add this in the build.gradle
android {
compileSdkVersion 18
buildToolsVersion '19.0.0'
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
versionCode 3
versionName "1.2"
}
buildTypes {
debug {
debuggable true
jniDebugBuild true
}
release {
debuggable false
jniDebugBuild true
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile files('build/libs/GoogleAdMobAdsSdk-6.4.1.jar')
}
but still does not work when i upload to play store
thanks

This is what I used and it worked perfectly
buildTypes {
debug {
debuggable false
}
release {
runProguard false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}

Related

"Application not installed on your phone" when accessing activity using product flavors. Any Advice?

My gradle has:
defaultConfig {
targetSdkVersion 26
applicationId 'com.company.appname'
}
buildTypes {
debug {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt', 'proguard-ulivewallpaper.txt'
jniDebuggable true
}
release {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt', 'proguard-ulivewallpaper.txt'
signingConfig signingConfigs.debug
}
}
productFlavors {
pro{
applicationId = "com.company.appname.pro"
flavorDimensions("default")
buildConfigField("boolean", "demomode", "false")
}
free{
applicationId = "com.company.appname.free"
flavorDimensions("default")
buildConfigField("boolean", "demomode", "true")
}
}
Not sure why but the app starts but when I want to access my settings activity, it says "Application not installed on your phone". Any help is appreciated.

Error:(12, 23) java: package org.apache.http does not exist

my android project doesn't contain build.gradle to put useLibrary 'org.apache.http.legacy'
Sample Build.gradle
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.Sample.App"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.1"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
debuggable false
jniDebuggable false
renderscriptDebuggable false
}
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
debuggable true
jniDebuggable true
renderscriptDebuggable true
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
}

Android Gradle sync failed (import project from github)

Hi guys i download a project from github and i imported in android studio , after imported am getting error
Gradle sync failed: Cause: assert localProps['keystore.props.file']
| |
| null
[ndk.dir:E:\sdk\ndk-bundle, sdk.dir:E:\sdk]
Consult IDE log for more details (Help | Show Log)
Gradle File:
signingConfigs {
release {
def Properties localProps = new Properties()
localProps.load(new FileInputStream(file('../local.properties')))
def Properties keyProps = new Properties()
assert localProps['keystore.props.file'];
keyProps.load(new FileInputStream(file(localProps['keystore.props.file'])))
storeFile file(keyProps["store"])
keyAlias keyProps["alias"]
storePassword keyProps["storePass"]
keyPassword keyProps["pass"]
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard-project.txt')
signingConfig signingConfigs.release
}
publicBeta.initWith(buildTypes.release)
publicBeta {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard-project.txt')
versionNameSuffix " Beta " + versionProps['betaNumber']
}
publicDebug.initWith(buildTypes.publicBeta)
publicDebug {
debuggable true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard-project.txt')
versionNameSuffix " Debug Beta " + versionProps['betaNumber']
}
}
}
I realy don't know what to do.
Does anyone have any suggestions?.
In the root folder of your project, you should have keystore.properties and local.properties files.
keystore.properties should have something like this:
store=/path/to/your.keystore
alias=your_alias
pass=your_password
storePass=your_keystore_password
In local.properties, add the last line.
ndk.dir=/Users/username/Library/Android/sdk/ndk-bundle
sdk.dir=/Users/username/Library/Android/sdk
# Add the line below
keystore.props.file=../keystore.properties
See a commit here or check the modified project.
Or if you need a quick dirty fix, just make the gradle script the same as a standard one by replacing the android block with this:
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
When I got such an error, it was because I was using JDK8, while the imported github repo was using JDK7.
Also make sure you have "Android Support Repository" installed from SDK Manager > Extras.

Gradle Warning: missing groovy return statement

I'm having the following warning in my gradle build file
Not all execution paths return a value
This inspection reports on missing groovy return statement at the end of methods returning
and this is the code in that file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "ac.company.srikar.quickhelpindia"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
}
Can anyone tell what is the issue here and how to get rid of this warning.
With Android Studio 2.2 I had to add a return void before the final bracket in the android section.
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
standard {
applicationId "com.example.app.standard"
}
free {
applicationId "com.example.app.free"
}
}
// `return void` removes the lint error: `Not all execution paths return a value`.
return void
}
I have been getting this same warning and I think it is incorrect. I have read through the gradle documentation and it does not appear that a return type is needed. However, the warnings bug me and the only way I could get rid of it was to add return true.
buildTypes {
android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
return true
}
}
}
I doubt this is the "correct" solution; however, it does remove the warnings and it doesn't cause any issues.
I fixed this by adding the recommended suppression string from inspection:
//noinspection GroovyMissingReturnStatement
android {
compileSdkVersion 25
buildToolsVersion "23.0.3"
...
I got rid of this warning when I specified both, minifyEnabled and shrinkResources.
buildTypes {
debug {
minifyEnabled false
shrinkResources false
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
It seems that this is an issue fixed in Android Studio 2.3:
https://code.google.com/p/android/issues/detail?id=223575

debuggable false in Android Studio 0.5.1

in the version 0.4.2 i write in the AndroidManifest
android:debuggable="false" to upload to play.store
but in the 0.5.1, i do not what to do.
Please, help me.
y resolved my problem with
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
foo{
debuggable false //add this
}
}
in the androidmanifest
i resolved the problem with
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
foo{
debuggable false //add this
}
}

Categories

Resources