Search code examples
androiddebugginguploadandroid-studio

Android: How to disable debugging to upload the apk


When I try to upload my app in Google Play I get this error.

Upload failed

You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs.

I compile my app with Android Studio 0.4.0

I tried to set this in my Manifest.xml - Android:debuggable="false" , but nothing happened. When I tried to set this <option name="SOURCE_GEN_TASK_NAME" value="generateReleaseSources" /> in .iml file, and again nothing.

I tried and with this in build.gradle,and again nothing.

android {
    signingConfigs {
        debug {
            storeFile file("horoskopSms.jks")
            storePassword "1q2w3e"
            keyAlias "horoskopSms"
            keyPassword "1q2w3e"
        }
    }
}

My.iml file

<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE"    type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
  <configuration>
    <option name="SELECTED_BUILD_VARIANT" value="debug" />
    <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
    <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
    <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
    <option name="SOURCE_GEN_TASK_NAME" value="generateReleaseSources" />
    <option name="ALLOW_USER_CONFIGURATION" value="false" />
    <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
    <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
    <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
    <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
    <option name="APK_PATH" value="/build/apk/HoroskopSms-debug-unaligned.apk" />
  </configuration>
</facet>
     <facet type="android-gradle" name="Android-Gradle">
     <configuration>
     <option name="GRADLE_PROJECT_PATH" value=":HoroskopSms" />
  </configuration>
</facet>
  </component>
           <component name="NewModuleRootManager" inherit-compiler-output="false">
        <output url="file://$MODULE_DIR$/build/classes/debug" />
      <exclude-output />
     <content url="file://$MODULE_DIR$">
   <sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" />

<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/debug"         isTestSource="false" />
 <sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" />
     <sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" type="java-resource" />
  <sourceFolder url="file://$MODULE_DIR$/build/source/r/test/debug" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test/debug" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test/debug" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/build/source/rs/test/debug" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/build/res/rs/test/debug" type="java-test-resource" />
  <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
  <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
  <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
  <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
  <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/aidl" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/assets" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/java" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/jni" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/rs" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/res" type="java-test-resource" />
  <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/resources" type="java-test-resource" />
  <excludeFolder url="file://$MODULE_DIR$/build/apk" />
  <excludeFolder url="file://$MODULE_DIR$/build/assets" />
  <excludeFolder url="file://$MODULE_DIR$/build/bundles" />
  <excludeFolder url="file://$MODULE_DIR$/build/classes" />
  <excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
  <excludeFolder url="file://$MODULE_DIR$/build/incremental" />
  <excludeFolder url="file://$MODULE_DIR$/build/libs" />
  <excludeFolder url="file://$MODULE_DIR$/build/manifests" />
  <excludeFolder url="file://$MODULE_DIR$/build/res" />
  <excludeFolder url="file://$MODULE_DIR$/build/symbols" />
  <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-v4-19.0.0" level="project" />
<orderEntry type="library" exported="" name="ComAndroidSupportAppcompatV71900.aar" level="project" />
<orderEntry type="library" exported="" name="FortumoInApp-android-9.1.0" level="project" />
</component>
       </module>

Solution

  • I found a solution in Android Studio, I go to "Build variants" and change it from debbug to release.