Gradle Release构建(使用Proguard)连续运行Android 3.0.1

时间:2018-02-12 12:24:44

标签: android crashlytics

Gradle构建持续运行,我已经使用3.0.1更新了Android Studio,其中包含所有依赖项的更新gradle插件。没有Proguard的Build Release版本工作正常。我没有在代码中使用crashlytics而是使用firebase,它在这些最后几行中都存在。怎么解决这个?

:app:compileReleaseNdk NO-SOURCE
:app:compileReleaseSources UP-TO-DATE
:app:processReleaseJavaRes NO-SOURCE
:app:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:app:transformClassesAndResourcesWithProguardForRelease UP-TO-DATE
Inlining subroutines...
 Obfuscating...
 Printing mapping to [..outputs\mapping\release\mapping.txt]...
 Preverifying...
Writing output...
Preparing output jar [..intermediates\transforms\proguard\release\0.jar]
 Printing classes to [..outputs\mapping\release\dump.txt]...
:app:crashlyticsStoreDeobsRelease
:app:crashlyticsUploadDeobsRelease

Proguard规则

-keepattributes Signature
-keepattributes *Annotation*
-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
 static final long serialVersionUID;
 private static final java.io.ObjectStreamField[] serialPersistentFields;
 !static !transient <fields>;
 private void writeObject(java.io.ObjectOutputStream);
 private void readObject(java.io.ObjectInputStream);
 java.lang.Object writeReplace();
 java.lang.Object readResolve();
 }

 -keep class com.onesignal.** { *; }

project gradle

buildscript {
repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'io.fabric.tools:gradle:1.25.1'
    classpath 'com.google.gms:google-services:3.1.1'
}
}
 allprojects {
repositories {
    jcenter()
    maven { url "https://maven.google.com" }
}
}

App Gradle

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.25.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.myproject"
    resConfigs "auto"


    minSdkVersion 16
    targetSdkVersion 24
    versionCode 2
    versionName "1.1"
}
buildTypes {
    release {
        debuggable true
        useProguard true
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        debuggable true
        minifyEnabled true
        useProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
useLibrary 'org.apache.http.legacy'
}

dependencies {
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.firebaseui:firebase-ui-auth:3.2.1'
implementation 'com.android.support:design:27.0.2'
implementation 'com.google.android.gms:play-services-gcm:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.onesignal:OneSignal:3.7.1'
implementation 'com.google.android.gms:play-services-analytics:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}

apply plugin: 'com.google.gms.google-services'

gradle属性

org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -
XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

1 个答案:

答案 0 :(得分:0)

我意外地让它运行超过1小时,然后使用

签署已发布的版本
  

minifyEnabled true

准备好了。

之后我收到了以下信息
:app:crashlyticsStoreDeobsRelease
:app:crashlyticsUploadDeobsRelease
 WARN - Crashlytics had a problem uploading the deobs file. Please check network connectivity and try again.
java.net.UnknownHostException: cm.crashlytics.com
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
at java.net.InetAddress.getAllByName(InetAddress.java:1126)

那是什么意思?无论您是否使用崩解代码,它都会将反混淆文件上传到cm.crashlytics.com !!

有什么方法可以禁用这个..uploading反混淆文件?

编辑:我在发布版本类型中使用了这个版本,现在几秒钟​​内签名发布版本已经准备就绪!!

  

ext.enableCrashlytics = false

src:How to disable Crashlytics while developing