Android Studio 更新(1.5 到 2.2.3)中断了项目
Android Studio update (1.5 to 2.2.3) breaks project
所以我已经将我的 Android Studio 从版本 1.5 更新到 2.2.3,这完全破坏了我的项目。我是编程新手,我的应用程序之前工作得很好,但现在,每个 android 库导入都标记为红色。
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.media.MediaPlayer;
import android.os.CountDownTimer;
例如,其中 none 个已被识别。我已经更新了所有内容 Android Studio 希望我更新,但我不知道如何解决这个问题。
我的 gradle 文件如下所示:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.privatpc.quiztest"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
build.gradle
// 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:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// 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
}
更新:
执行 File-> "Invalidate Caches/Restart" 似乎有效。现在下一个问题如下:
一旦我尝试 运行 项目,应用程序打开并立即崩溃。我得到以下日志:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
尝试在 build.gradle
中执行此操作
buildscript {存储库 {jcenter()}依赖项 {类路径 'com.android.tools.build:gradle:2.2.3'}}
如果您在 Android 7 以下的设备上试用,请使用 V1 签名而非 V2 签名生成 APK。如果您 select V2 签名,所有应用程序都会崩溃,因为它针对 Android 7.
signature
所以我已经将我的 Android Studio 从版本 1.5 更新到 2.2.3,这完全破坏了我的项目。我是编程新手,我的应用程序之前工作得很好,但现在,每个 android 库导入都标记为红色。
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.media.MediaPlayer;
import android.os.CountDownTimer;
例如,其中 none 个已被识别。我已经更新了所有内容 Android Studio 希望我更新,但我不知道如何解决这个问题。
我的 gradle 文件如下所示:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.privatpc.quiztest"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
build.gradle
// 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:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// 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
}
更新: 执行 File-> "Invalidate Caches/Restart" 似乎有效。现在下一个问题如下:
一旦我尝试 运行 项目,应用程序打开并立即崩溃。我得到以下日志:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
尝试在 build.gradle
中执行此操作buildscript {存储库 {jcenter()}依赖项 {类路径 'com.android.tools.build:gradle:2.2.3'}}
如果您在 Android 7 以下的设备上试用,请使用 V1 签名而非 V2 签名生成 APK。如果您 select V2 签名,所有应用程序都会崩溃,因为它针对 Android 7.
signature