Android Studio 3.0 Canary 2:找不到属性"android:versionCode" [英] Android Studio 3.0 Canary 2: attribute 'android:versionCode' not found

查看:165
本文介绍了Android Studio 3.0 Canary 2:找不到属性"android:versionCode"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将Android Studio更新为最新的Canary版本,但是现在我无法运行我的应用程序.

I've updated Android Studio to the latest canary build and now I can't run my app.

每次尝试构建项目时,都会出现以下错误:

Every time when I try to build the project I get the following error:

Error:F:\...\**app_name**\app\build\intermediates\instant-run-support\debug\slice_0\AndroidManifest.xml:2 attribute 'android:versionCode' not found

我尝试手动打开文件,并且属性显然存在:

I tried to manually open the file and the attribute is clearly there:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="****"
      android:versionCode="1"
      android:versionName="1.0"
      split="lib_slice_0_apk">
</manifest>

我试图清理项目,使缓存无效,重新启动android studio,但没有任何帮助.

I've tried to clean the project, invalidate cache, restart android studio but nothing helped.

这是我的build.gradle (app)文件:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "****"
        minSdkVersion 16
        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(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    compile 'com.android.support:appcompat-v7:25.3.1'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
}

推荐答案

此问题与即时运行"严格相关.解决方法:在File-> Settings/Preferences中将其禁用.这样至少可以让您在AS的Canary版本中运行您的应用.

This issue is strictly related to Instant Run. Workaround: disable it inside File -> Settings/Preferences. This will at least allow you to run your app in the Canary version of AS.

这篇关于Android Studio 3.0 Canary 2:找不到属性"android:versionCode"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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