Search Unity

2019.3 -> You uploaded a debuggable APK

Discussion in 'Android' started by DavidSmit, Oct 8, 2019.

  1. DavidSmit

    DavidSmit

    Joined:
    Apr 1, 2014
    Posts:
    50
    EDIT:
    Fixed, look at the Next post.
    ----

    Hi all,

    I'm a bit baffled, and I'm hoping some Android genius can help me out!

    I've got a game on the Google play store. It's all fine and good.
    Now I've been trying to make a new build and upload that one. But every time I get the following error:

    "Upload failed You uploaded a debuggable APK or Android App Bundle. For security reasons you need to disable debugging before it can be published in Google Play."

    I don't have Development build checked. I got a keystore file and password added correctly. I even tried a new Keystore file, and signed it with that, with the same result.
    buildSettings.png

    When I inspect the final APK Manifest in Android studio it has the following line:
    "android:debuggable="true""
    buidManifest.png

    I'm guessing it's something I am overlooking. But I have no clue what.

    I tried the build on 2 PC with 2019.3.0b6 and on one with 2019.3.0b4
    Any help would be super appreciated!
     
    Last edited: Oct 8, 2019
  2. DavidSmit

    DavidSmit

    Joined:
    Apr 1, 2014
    Posts:
    50
    Got it!

    For anyone else having this issue. If you are using FacebookSDK which comes with Google Play services, it can be that in injects a Debuggable=true key in the Manifest, for whatever reason.

    I could fix it by going to Assets>Android>AndroidManifest.xml
    In there find 'android:debuggable="true"' and set it to false.

    Easy to overlook when 10 things are on 1 line.
     
  3. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    Thank you VERY MUCH for this advice! Worked for me as well.
     
    Yuafa and eragimov like this.
  4. dhwanit-z

    dhwanit-z

    Joined:
    Jun 20, 2020
    Posts:
    2
    THIS IS IT! ABSOLUTE LEGEND!
     
    Feelnside and eragimov like this.
  5. _Radagan

    _Radagan

    Joined:
    May 16, 2014
    Posts:
    38
    Thank you! That was it!
     
  6. ersagun

    ersagun

    Joined:
    Jun 26, 2016
    Posts:
    1
    Thanks for the solution mate. This is exemplary behaviour everyone.
     
    tastywall and MrKrakenVR like this.
  7. mburmancx

    mburmancx

    Joined:
    Jun 3, 2016
    Posts:
    1
    Same here!
     
  8. xjjon

    xjjon

    Joined:
    Apr 15, 2016
    Posts:
    612
    as if they did it just to troll us
     
    Energy0124 likes this.
  9. ycanatilgan

    ycanatilgan

    Joined:
    Aug 23, 2017
    Posts:
    30
    Worked perfect, thanks!
     
  10. OceanViewGames

    OceanViewGames

    Joined:
    Dec 26, 2019
    Posts:
    19
    Thank you !
     
  11. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    Thanks, this still is happening and this solved it for me.
     
  12. marisvali

    marisvali

    Joined:
    Feb 10, 2017
    Posts:
    1
    Thanks, I installed the Facebook SDK and this solution solved the problem.
     
  13. temoorwali

    temoorwali

    Joined:
    Feb 16, 2015
    Posts:
    3
    It worked. Thanks
     
  14. MJonee

    MJonee

    Joined:
    Oct 19, 2013
    Posts:
    20
    Thanks!!
     
  15. eliteforcevn

    eliteforcevn

    Joined:
    Oct 25, 2018
    Posts:
    47
    thanks
     
  16. eyupunity

    eyupunity

    Joined:
    Jul 25, 2019
    Posts:
    4
    Thanks :)
     
  17. kyxap

    kyxap

    Joined:
    Aug 20, 2021
    Posts:
    8
    got same issue with fb sdk v11, and now manifest located in

    ./Assets/Plugins/Android/AndroidManifest.xml


    anyway this resolved my issue
     
    Last edited: Oct 1, 2021
    rpuls likes this.
  18. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,965
    Here is a solution we use in our plugins to patch final manifest automatically (Modified here for easy integration).
    Do let us know if you see any issues.

    Usage: Place the below script under Editor folder.

    Code (CSharp):
    1. #if UNITY_EDITOR && UNITY_ANDROID
    2. using System.IO;
    3. using System.Text;
    4. using System.Xml;
    5. using UnityEditor.Android;
    6.  
    7. namespace VoxelBusters.EssentialKit.Editor.Android
    8. {
    9.     public class AndroidManifestPostProcessor : IPostGenerateGradleAndroidProject
    10.     {
    11.         public void OnPostGenerateGradleAndroidProject(string basePath)
    12.         {
    13.             EssentialKitSettings settings;
    14.             if (!EssentialKitSettingsEditorUtility.SettingsExists)
    15.             {
    16.                 return;
    17.             }
    18.  
    19.  
    20.             AndroidManifest androidManifest = new AndroidManifest(GetManifestPath(basePath));
    21.  
    22.             //For forcing android hardwareAccelerated flag : Comment below if you don't need to force hardware acceleration flag
    23.             androidManifest.SetApplicationAttribute("hardwareAccelerated", "true");
    24.             androidManifest.SetStartingActivityAttribute("hardwareAccelerated", "true");
    25.  
    26.             //For forcing debuggable flag to respect EditorUserBuildSettings value
    27.             androidManifest.SetApplicationAttribute("debuggable", UnityEditor.EditorUserBuildSettings.development ? "true" : "false");
    28.  
    29.             androidManifest.Save();
    30.         }
    31.  
    32.         public int callbackOrder { get { return 1; } }
    33.  
    34.         private string _manifestFilePath;
    35.  
    36.         private string GetManifestPath(string basePath)
    37.         {
    38.             if (string.IsNullOrEmpty(_manifestFilePath))
    39.             {
    40.                 StringBuilder pathBuilder = new StringBuilder(basePath);
    41.                 pathBuilder.Append(Path.DirectorySeparatorChar).Append("src");
    42.                 pathBuilder.Append(Path.DirectorySeparatorChar).Append("main");
    43.                 pathBuilder.Append(Path.DirectorySeparatorChar).Append("AndroidManifest.xml");
    44.                 _manifestFilePath = pathBuilder.ToString();
    45.             }
    46.             return _manifestFilePath;
    47.         }
    48.     }
    49.  
    50.     //Reference Used : https://github.com/Over17/UnityAndroidManifestCallback
    51.     internal class AndroidXmlDocument : XmlDocument
    52.     {
    53.         private string m_Path;
    54.         protected XmlNamespaceManager nsMgr;
    55.         public readonly string AndroidXmlNamespace = "http://schemas.android.com/apk/res/android";
    56.         public AndroidXmlDocument(string path)
    57.         {
    58.             m_Path = path;
    59.             using (var reader = new XmlTextReader(m_Path))
    60.             {
    61.                 reader.Read();
    62.                 Load(reader);
    63.             }
    64.             nsMgr = new XmlNamespaceManager(NameTable);
    65.             nsMgr.AddNamespace("android", AndroidXmlNamespace);
    66.         }
    67.  
    68.         public string Save()
    69.         {
    70.             return SaveAs(m_Path);
    71.         }
    72.  
    73.         public string SaveAs(string path)
    74.         {
    75.             using (var writer = new XmlTextWriter(path, new UTF8Encoding(false)))
    76.             {
    77.                 writer.Formatting = Formatting.Indented;
    78.                 Save(writer);
    79.             }
    80.             return path;
    81.         }
    82.     }
    83.  
    84.  
    85.     internal class AndroidManifest : AndroidXmlDocument
    86.     {
    87.         private readonly XmlElement ApplicationElement;
    88.  
    89.         public AndroidManifest(string path) : base(path)
    90.         {
    91.             ApplicationElement = SelectSingleNode("/manifest/application") as XmlElement;
    92.         }
    93.  
    94.         private XmlAttribute CreateAndroidAttribute(string key, string value)
    95.         {
    96.             XmlAttribute attr = CreateAttribute("android", key, AndroidXmlNamespace);
    97.             attr.Value = value;
    98.             return attr;
    99.         }
    100.  
    101.         internal XmlNode GetActivityWithLaunchIntent()
    102.         {
    103.             return SelectSingleNode("/manifest/application/activity[intent-filter/action/@android:name='android.intent.action.MAIN' and " +
    104.                     "intent-filter/category/@android:name='android.intent.category.LAUNCHER']", nsMgr);
    105.         }
    106.  
    107.         internal void SetApplicationTheme(string appTheme)
    108.         {
    109.             ApplicationElement.Attributes.Append(CreateAndroidAttribute("theme", appTheme));
    110.         }
    111.  
    112.         internal void SetStartingActivityName(string activityName)
    113.         {
    114.             GetActivityWithLaunchIntent().Attributes.Append(CreateAndroidAttribute("name", activityName));
    115.         }
    116.  
    117.         internal void SetApplicationAttribute(string key, string value)
    118.         {
    119.             ApplicationElement.Attributes.Append(CreateAndroidAttribute(key, value));
    120.         }
    121.  
    122.         internal void SetStartingActivityAttribute(string key, string value)
    123.         {
    124.             XmlNode node = GetActivityWithLaunchIntent();
    125.             if(node != null)
    126.             {
    127.                 XmlAttributeCollection  attributes = node.Attributes;
    128.                 attributes.Append(CreateAndroidAttribute(key, value));
    129.             }
    130.         }
    131.     }
    132. }
    133. #endif
    134.  

    Thanks,
    VB Team
     
  19. Rodlaiz

    Rodlaiz

    Joined:
    Jul 30, 2013
    Posts:
    38
    Nice one! Many thanks for sharing.
     
    Voxel-Busters likes this.
  20. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    thank you!
     
  21. vizard00

    vizard00

    Joined:
    Feb 10, 2017
    Posts:
    13
    Thank you
     
  22. IOU_RAY

    IOU_RAY

    Joined:
    Jul 25, 2017
    Posts:
    127
    +1 saved me a lot of confusion :) Cheers
     
  23. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    781
    it work!

    Thnak you very much!!!
     
  24. yash_artixun

    yash_artixun

    Joined:
    Mar 28, 2022
    Posts:
    1

    Thank you! You're still Saving People!
     
  25. davitsedrakian

    davitsedrakian

    Joined:
    Jun 23, 2018
    Posts:
    30

    Thanks mate!
     
  26. dookosgames

    dookosgames

    Joined:
    Oct 12, 2018
    Posts:
    4
    Thank you so much!
     
  27. SKGowrob

    SKGowrob

    Joined:
    Sep 12, 2021
    Posts:
    11
    oh, thanks so much...