错误:http错误:android生成签名apk

时间:2018-06-01 15:58:49

标签: java android android-studio gradle server

我从github下载了hyperrack live并跟进整个教程一切正常但是当我生成签名的apk“错误:http错误:内部错误(500)”这个错误发生了一段时间“Server time out”错误发生了我试试看看最好,但我找不到代码Sentry.property文件的解决方案,并且编译也包括在gradle我认为这个错误与Sentry服务器有关但我对Sentry不熟悉,我在互联网上搜索了很多,但没有找到。首先它给出了弃用错误我给出了surpress警告的注释然后只发生了一个错误,即内部错误(500)请帮我解决这个错误

这是我的build.gradle项目级别

     apply from: 'versioning.gradle'



   buildscript {
       repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.google.com/' }
        google()
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0'
    classpath 'com.google.gms:google-services:3.1.0'
    classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5'
    classpath 'io.sentry:sentry-android-gradle-plugin:1.6.4'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
   }

allprojects {
    repositories {
        jcenter()
       maven { url "https://maven.google.com" }
    maven { url 'https://jitpack.io' }
    maven { url "https://plugins.gradle.org/m2/" }
    maven { url 'http://hypertrack-android-sdk.s3-website-us-west-2.amazonaws.com/' }

    google()

       }
tasks.withType(JavaCompile) {
    options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
}
}

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

这是我的项目级别gradle

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

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

repositories {
    maven { url 'https://maven.fabric.io/public' }
    HyperTrack Repository
    maven { url 'http://hypertrack-android-sdk.s3-website-us-west- 
 2.amazonaws.com/' }
}

sentry {
// Disables or enables the automatic configuration of proguard
// for Sentry.  This injects a default config for proguard so
// you don't need to do it manually.
    autoProguardConfig true

// Enables or disables the automatic upload of mapping files
// during a build.  If you disable this you'll need to manually
// upload the mapping files with sentry-cli when you do a release.
    autoUpload true
 }

android {

compileSdkVersion 26
buildToolsVersion '27.0.3'
lintOptions {
    abortOnError false
    checkReleaseBuilds false

}


//Check if Fabric crashlyitcs is configured or not.
def fabricCheck = false;
File fabricPropertiesFile = rootProject.file("app/fabric.properties");
if (fabricPropertiesFile.exists()) {
    System.out.println("Fabric File Exist");
    def fabricProperties = new Properties()
    fabricProperties.load(new FileInputStream(fabricPropertiesFile))
    String apiSecret = fabricProperties['apiSecret'];
    if (apiSecret != null && !apiSecret.isEmpty() && !apiSecret.equalsIgnoreCase("CRASHLYTICS_API_SECRET")) {
        System.out.println("Key Exist");
        fabricCheck = true;
    } else {
        System.out.println("Key Doesnt Exist");
    }
}

/*
*   Set App version using gradle.properties file
* */
def versionPropsFile = file('gradle.properties')
if (versionPropsFile.canRead()) {
    def Properties versionProps = new Properties()

    versionProps.load(new FileInputStream(versionPropsFile))

    def value = 0

    def runTasks = gradle.startParameter.taskNames
    if ('cUDD' in runTasks || 'crashlyticsUploadDistributionDebug' in runTasks
            || 'cUDR' in runTasks || 'crashlyticsUploadDistributionRelease' in runTasks) {
        value = 1
    }

    def versionMajor = 4
    def versionMinor = 0
    def versionPatch = versionProps['VERSION_PATCH'].toInteger() + value
    def versionNumber = versionProps['VERSION_NUMBER'].toInteger() + value

    versionProps['VERSION_PATCH'] = versionPatch.toString()
    versionProps['VERSION_NUMBER'] = versionNumber.toString()
    versionProps['version'] = versionMajor + "." + versionMinor + "." + versionPatch
    versionProps.store(versionPropsFile.newWriter(), null)

    defaultConfig {
        applicationId "com.myapplicationid.given"
        versionCode 1
        versionName "1.0"
        minSdkVersion 16
        targetSdkVersion 22
        resValue "string", "app_name", "HyperTrack Live"
        buildConfigField "String", "HYPERTRACK_BASE_URL_V1", '"https://api.hypertrack.com/api/v1/"'
        buildConfigField "String", "HYPERTRACK_BASE_URL_V2", '"https://api.hypertrack.com/api/v2/"'

        resValue "string", "deeplink_scheme", "com.hypertracklive"
        resValue "string", "tracking_url", "trck.at"
        manifestPlaceholders = [applicationLabel: "@string/app_name"]
        multiDexEnabled true
     /*   if (keystorePropertiesFile.exists())
            signingConfig signingConfigs.release
        if (findProject(':library') != null)
            buildConfigField "String", "isHyperTrackLive", '"exist"'
        else
            buildConfigField "String", "isHyperTrackLive", '""'*/
    }

} else {
    throw new GradleException("Could not read version.properties!")
}

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        def newFileName = "HyperTrackLive-${variant.versionName}.apk"
        def apk = output.outputFile
        //System.out.println(apk.parent + ", newfilename: " + newFileName)
        output.outputFileName = new File("../", newFileName)
    }
}

buildTypes {

    debug {
        ext.enableCrashlytics = false
    }
    release {
        def keyPropertiesFile = rootProject.file("app/src/release/java/io/hypertrack/sendeta/key.properties")
        if (keyPropertiesFile == null || !keyPropertiesFile.exists()) {
            throw new GradleException("key.properties file is missing that contains HyperTrack Publishable Key." +
                    "\nRefer Step 2 at https://github.com/hypertrack/hypertrack-live-android#to-use-this-app for more info.");
        }
        def keyProperties = new Properties();
        keyProperties.load(new FileInputStream(keyPropertiesFile));
        if (keyProperties['HYPERTRACK_PUBLISHABLE_KEY'] == "\"HYPERTRACK_PUBLISHABLE_KEY\"") {
            throw new GradleException("Publishable Key is Missing in key.properties file.\nRefer Step 2 at https://github.com/hypertrack/hypertrack-live-android#to-use-this-app for more info.");
        }
        debuggable false
        minifyEnabled true
        buildConfigField "String", "HYPERTRACK_PK", keyProperties['HYPERTRACK_PUBLISHABLE_KEY']
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        if (!fabricCheck) {
            ext.enableCrashlytics = false
        }
    }

}
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:2.8.9'
    testImplementation 'org.robolectric:robolectric:3.8'
    debugImplementation 'com.facebook.stetho:stetho:1.5.0'

// Other dependencie
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.facebook.stetho:stetho:1.5.0'
    compile 'io.sentry:sentry-android:1.7.5'



if (findProject(':library') != null) {
    // HyperTrack SDK dependency
    implementation(project(':library')) {
        transitive = true
    }
} else {
    implementation("com.hypertrack:android:0.7.21@aar") {
        transitive = true;
    }
 }

implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
    transitive = true;
}
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.4.2'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.sundeepk:compact-calendar-view:1.9.2-beta'
implementation 'com.github.rubensousa:gravitysnaphelper:1.1'
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'

implementation 'com.github.Q42:AndroidScrollingImageView:1.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
    transitive = true
}

implementation 'com.android.support:multidex:1.0.3'

// Leak Canary dependency for Debug builds
debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'

releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'

//Check if SDK library exist or not
if (findProject(':library') != null) {
    println("Library Exist");
    implementation project(':library')
} else {
    println("Library Doesn't Exist");
}
}

/*
* Enable FCM integration for real time tracking by adding a google- 
services.json
* Once you have either an existing account on <a 
href="https://console.developers.google.com/">Google Developer</a> or a new 
account <a href="https://console.firebase.google.com">Firebase console</a>, 
you will need to add <a 
href="https://support.google.com/firebase/answer/7015592">google- 
services.json</a> file for your app to remove the below compilation failure.
*/
File googleServicesFile = rootProject.file("app/google- 
services.json");
if (googleServicesFile.exists()) {
    System.out.println("Google Service File Exist");
    apply plugin: 'com.google.gms.google-services'
}

这是Sentry.Properties

defaults.project=hypertrack-android-sdk
defaults.org=hypertrack-ai
auth.token=6b30a683022e4ae483900445c3cfc1c1b1c76a7b2b324a1db371ede79dce89ee

这里是Proguard

 enter code here`# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard- 
android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

    -keepattributes *Annotation*

-keep public class com.google.** {*;}
-keep class com.crashlytics.** { *; }
-keep class com.crashlytics.android.**
-keep class com.facebook.** { *; }
-keep class com.squareup.okhttp.** { *; }
-keep class retrofit2.** { *; }
-keep class io.hypertrack.sendeta.model.** { *; }
-keep class io.hypertrack.sendeta.network.** { *; }
-keep class io.hypertrack.sendeta.store.** { *; }
-keep class maps.** { *; }
-keep class com.hypertrack.lib.** { *; }

-keep interface com.squareup.okhttp.** { *; }

-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
 }

-keepattributes JavascriptInterface

-dontwarn com.squareup.okhttp.**
-dontwarn retrofit2.**
-dontwarn okio.**
-dontwarn com.google.android.gms.**
-dontwarn com.hypertrack.lib.**

-keepclasseswithmembers class * {
    @retrofit.http.* <methods>;
}

-keepattributes Signature
-keepattributes Exceptions

-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile

-keepattributes *Annotation*

## For Retrofit
-keepattributes Signature

## Other
-dontwarn com.google.common.**
-dontwarn io.branch.**

如果我对Sentry发表评论,那么每件事情都会有效,但是重复输入和io.sentry消息会发出很长的警告和错误。* packages

锄头我可以克服这个错误,我的apk生成成功,请帮帮我

0 个答案:

没有答案