NumberFormatException:无效的版本:24.0.0-alpha1:无效的版本:24.0.0-alpha1

Ale*_*ich 9 android numberformatexception android-studio

Android studio在事件日志中显示错误NumberFormatException:无效版本:24.0.0-alpha1:无效版本:24.0.0-alpha1

的build.gradle:

    apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    defaultConfig {
        applicationId "com.xxxx"
        minSdkVersion 10
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':library')
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:support-v4:23.2.1'
    compile 'com.google.guava:guava:18.0'
    compile 'com.android.support:appcompat-v7:23.0.2'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.google.android.gms:play-services-analytics:8.1.0'
    compile files('libs/gdata-base-1.0.jar')
    compile files('libs/gdata-calendar-2.0.jar')
    compile files('libs/gdata-calendar-meta-2.0.jar')
    compile files('libs/gdata-client-1.0.jar')
    compile files('libs/gdata-client-meta-1.0.jar')
    compile files('libs/gdata-contacts-3.0.jar')
    compile files('libs/gdata-contacts-meta-3.0.jar')
    compile files('libs/gdata-core-1.0.jar')
    compile files('libs/gdata-maps-2.0.jar')
    compile files('libs/gdata-maps-meta-2.0.jar')
}
Run Code Online (Sandbox Code Playgroud)

IDE致命错误告诉我这样的事情:

插件Android支持中的此例外.

java.lang.NumberFormatException:com.android.sdklib.repository.FullRevision.parseRevision(FullRevision.java:)中的com.android.sdklib.repository.FullRevision.parseRevisionImpl(FullRevision.java:198)中的版本无效:24.0.0-alpha1: 127)com.android.ide.common.repository.SdkMavenRepository.getHighestInstalledVersion(SdkMavenRepository.java:179)com.android.tools.lint.checks.GradleDetector.checkLocalMavenVersions(GradleDetector.java:1092)...

小智 5

SDK更新后,我遇到了同样的问题。在我的情况下,解决方案是从sdk / extras / android / m2repository / com / android / support / appcompat-v7删除24.0.0-alpha1文件夹,并从sdk / extras / android / m2repository / com / android / support删除<version>24.0.0-alpha1</version>行/appcompat-v7/maven-metadata.xml


小智 -1

如果您确实需要 24.0.0-alpha1,请尝试以下情况:

  1. 代替

    compile 'com.android.support:appcompat-v7:23.0.2'
    compile 'com.android.support:support-v4:23.2.1'
    
    Run Code Online (Sandbox Code Playgroud)

    compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
    compile 'com.android.support:support-v4:24.0.0-alpha1'
Run Code Online (Sandbox Code Playgroud)
  1. 启动 stanalone SDK 管理器并加载 Android N、API 23、N 预览版,之后需要替换

    compileSdkVersion 23
    
    Run Code Online (Sandbox Code Playgroud)

    compileSdkVersion 'android-N'
Run Code Online (Sandbox Code Playgroud)

告诉我它是否也适合你。