【问题标题】:Why can I see server response in my signed apk android?为什么我可以在我签名的 apk android 中看到服务器响应?
【发布时间】:2017-05-30 13:14:53
【问题描述】:

我使用 .jks 文件生成了一个签名的 apk 用于发布。 它也被上传到 Playstore 进行 Beta 测试。但是,如果我将应用程序与我的 andorid-studio 一起使用,我可以在我的 log-cat 中看到服务器响应,据我所知,情况并非如此。

当我生成 apk 时,我可以看到构建类型发布

而我的 build.gradle 模块是:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "PACKAGE_NAME"
    minSdkVersion 19
    targetSdkVersion 23
    versionCode 1
    multiDexEnabled true

    versionName "1.0.2"

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets {
    main {
        res.srcDirs = ['src/main/res', 'src/main/res/menu']
        java.srcDirs = ['src/main/java', 'src/main/java/2', 'src/main/java/PACKAGE_NAME/Models']
    }
}
productFlavors {
}
}

谁能解释一下?

【问题讨论】:

  • 发布您的应用模块的build.gradle
  • @azizbekian 已编辑.. 请看看 :)
  • 只是为了确定:您使用的是 Log.d(或其他)而不是 System.out,对吗? :)
  • @Prexx 我也在使用 system.out,是的
  • 您在发布 apk 中看到的日志是您使用“System.out”记录的日志吗?

标签: android apk android-keystore signed-apk android-signing


【解决方案1】:

在详细程度方面,从少到多的顺序是 ERROR、WARN、INFO、DEBUG、VERBOSE。除非在开发期间,否则永远不应将详细信息编译到应用程序中。调试日志被编译,但在运行时被剥离。始终保留错误、警告和信息日志。

你可以像下面这样使用你的日志

public class AppLog {

    public static void info(String tag, String message) {
       if (BuildConfig.DEBUG) {
        Log.i(tag, message);
      }
   }
}

参考:https://developer.android.com/reference/android/util/Log.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    • 2013-01-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多