更新后找不到android:versionCode [英] android:versionCode not found after update

查看:73
本文介绍了更新后找不到android:versionCode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将Android Studio更新到了我的应用现在无法构建的最新金丝雀.
我尝试手动添加版本代码.
我已经尝试过

I've updated Android Studio to the latest canary my app wont build now.
I tried adding version code manually.
I already tried

文件>使缓存无效&重新启动

File > Invalidate Caches & Restart

,它没有用.这是我的build.gradle

and it didnt work. Here is my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.rishav.sql"
        minSdkVersion 25
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'

    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

//顶层构建文件,您可以在其中添加所有子项目/模块共有的配置选项.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

这是我的清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.rishav.sql">

    <application
        android:allowBackup="true"

        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

推荐答案

该错误已在最新的Canary版本中得到解决:

This bug was resolved in the last Canary release:

Android Studio 3.0 Canary 4 Build#AI-171.4101728,建于2017年6月14日JRE:1.8.0_112-release-736 amd64

Android Studio 3.0 Canary 4 Build #AI-171.4101728, built on June 14, 2017 JRE: 1.8.0_112-release-736 amd64

只需更新android studio.

Just update android studio.

-

在Android设置中禁用即时运行.就目前而言,似乎无法解决此问题.

Disable instant run in Android Settings. It seems to be no solution to this problem with the instant run on, for now.

我尝试了该线程中指出的所有解决方案,但没有任何效果:

I tried all the solutions pointed out in this thread and nothing worked:

​​ Android Studio 3.0 Canary 2:属性'android:versionCode'找不到

这篇关于更新后找不到android:versionCode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆