同步Gradle失败:错误:输入字符串:“”

问题描述 投票:0回答:2

我在Gradle文件中没有任何Google服务,但它仍然给我这个错误ERROR: For input string: ""

我没有添加任何Firebase SDK或AdMob,它更可能与我不了解的依赖关系中的故障或错误或需要在这方面需要更新的内容相关

她是build.gradle代码:

apply plugin: 'com.android.application'

def gitCommits = 'git rev-list --all --count'.execute([], rootDir).text.trim().toInteger()

def timestamp = new Date().getTime()

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "org.app.appname"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode gitCommits
        versionName "5.0"

        resConfigs "en", "ru", "tr", "uk"
        buildConfigField "boolean", "SELFUPDATE_ENABLED", "false"
        buildConfigField "String", "SELFUPDATE_URL", "\"http://randomwebsite.link/v.0.3/get/openmanga/version\""
        buildConfigField "String", "SYNC_URL", "\"http://random.random.com/api/v1\""
        buildConfigField "long", "TIMESTAMP", "${timestamp}L"
    }

    signingConfigs {
        debug {
            storeFile file("debug.jks")
            storePassword "develop"
            keyAlias "develop"
            keyPassword "develop"
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            setProperty("archivesBaseName", "OpenManga-v${defaultConfig.versionName}")
            resValue "string", "app_name", "OpenManga"
        }

        debug {
            zipAlignEnabled true
            applicationIdSuffix ".debug"
            versionNameSuffix="a"
            signingConfig signingConfigs.debug
            resValue "string", "app_name", "OpenManga Debug"
        }

        fdroid {
            initWith release
            buildConfigField "boolean", "SELFUPDATE_ENABLED", "false"
            versionNameSuffix="-fdroid"
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    lintOptions {
        disable 'MissingTranslation'
        abortOnError false
    }
}

ext {
    supportLib = '28.0.0'
}

dependencies {
    implementation "com.android.support:design:28.0.0"
    implementation "com.android.support:support-v13:28.0.0"
    implementation "com.android.support:recyclerview-v7:28.0.0"
    implementation "com.android.support:cardview-v7:28.0.0"
    implementation "com.android.support:exifinterface:28.0.0"

    implementation 'com.squareup.okhttp3:okhttp:3.11.0'
    implementation 'com.squareup.duktape:duktape-android:1.3.0'
    implementation 'info.guardianproject.netcipher:netcipher:2.0.0-beta1'
    implementation 'info.guardianproject.netcipher:netcipher-okhttp3:2.0.0-alpha1'
    implementation 'org.jsoup:jsoup:1.11.3'
    implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}

我更有可能是盲人或者别的什么,但我现在会喜欢一些帮助,我明白我可能会错过一些东西

我该如何解决这个问题?怎么了?

java android android-gradle
2个回答
0
投票

我想我找到了一个解决方案,因为没有人没有看到它

所以我做了它,我删除了build.gradle中的两行代码:

def gitCommits = 'git rev-list --all --count'.execute([],

versionCode gitCommits


0
投票

错误:输入字符串:“”

您正在尝试将String转换为Integer,但由于该变量不包含有效数据,因此它会抛出错误。

这条线

def gitCommits = 'git rev-list --all --count'.execute([], rootDir).text.trim().toInteger()

不返回整数和versionCode(因为你使用versionCode gitCommits)期望Integer值。

© www.soinside.com 2019 - 2024. All rights reserved.