簡體   English   中英

Android Studio:為什么 Release Build 是可調試的?

[英]Android Studio: Why is Release Build debuggable?

我一直在嘗試使用 Android Studio 生成一個不可調試的發布版本,以便我可以將其上傳到 Google Play。 但遺憾的是,這是行不通的。 當我嘗試上傳 apk 時,出現以下錯誤:

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

這不是重復的。 我已經嘗試了相關問題中建議的所有內容...

更新

我已經解碼了生成的apk。 BuildConfig.class 如下所示:

public final class BuildConfig
{
  public static final String APPLICATION_ID = "com.myapplication.packagename";
  public static final String BUILD_TYPE = "release";
  public static final boolean DEBUG = false;
  public static final String FLAVOR = "";
  public static final int VERSION_CODE = 2;
  public static final String VERSION_NAME = "1.0.1";
}

所以構建類型實際上是release並且 debug 設置為false

但是在AndroidManifest.xml里面,gradle已經把

<application android:debuggable="true"...

可調試設置為true 怎么來的!?

我終於可以找到原因並解決問題了!

原因是我引用了庫模塊,其中包含一個帶有 debuggable="true" 標記的 AndroidManifest.xml。 我已將它們更改為“false”,現在可以使用了!

我不知道為什么 Android Studio 選擇這個“信息”而不是 gradle 設置......無論如何我很高興它現在可以工作了!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM