Android工作室不会识别appcompat或任何其他默认项目

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

今天我重新打开了一个应用程序(几个月后),之前我曾在几个月前工作过。但不幸的是,一切似乎都停止了该应用程序代码的工作。我通过互联网搜索各种黑客如何解决appcompatactivity not resolved

r Theme.AppCompat.Light.DarkActionBar not recognized

但我似乎完全混合了所有最奇怪的错误..

这是我从Android Studio获得的礼物 -

java compiler errors(14 errors)
resource style/Animation.AppCompat.Dialog (aka com.actech.android.frienchat:style/Animation.AppCompat.Dialog) not found.    
resource style/Theme.AppCompat.Light.DarkActionBar (aka com.actech.android.frienchat:style/Theme.AppCompat.Light.DarkActionBar) not found.  
resource style/TextAppearance.AppCompat (aka com.actech.android.frienchat:style/TextAppearance.AppCompat) not found.    
resource style/Base.V7.Theme.AppCompat.Dialog (aka com.actech.android.frienchat:style/Base.V7.Theme.AppCompat.Dialog) not found.    
resource style/Base.V7.Theme.AppCompat.Light.Dialog (aka com.actech.android.frienchat:style/Base.V7.Theme.AppCompat.Light.Dialog) not found.    
resource style/Base.V7.ThemeOverlay.AppCompat.Dialog (aka com.actech.android.frienchat:style/Base.V7.ThemeOverlay.AppCompat.Dialog) not found.  
resource style/Base.V7.Theme.AppCompat (aka com.actech.android.frienchat:style/Base.V7.Theme.AppCompat) not found.  
resource style/Animation.AppCompat.Dialog (aka com.actech.android.frienchat:style/Animation.AppCompat.Dialog) not found.    
resource style/Theme.AppCompat.Light.DarkActionBar (aka com.actech.android.frienchat:style/Theme.AppCompat.Light.DarkActionBar) not found.  
resource style/TextAppearance.AppCompat (aka com.actech.android.frienchat:style/TextAppearance.AppCompat) not found.    
resource style/Base.V7.Theme.AppCompat.Dialog (aka com.actech.android.frienchat:style/Base.V7.Theme.AppCompat.Dialog) not found.    
resource style/Base.V7.Theme.AppCompat.Light.Dialog (aka com.actech.android.frienchat:style/Base.V7.Theme.AppCompat.Light.Dialog) not found.    
resource style/Base.V7.ThemeOverlay.AppCompat.Dialog (aka com.actech.android.frienchat:style/Base.V7.ThemeOverlay.AppCompat.Dialog) not found.  
resource style/Base.V7.Theme.AppCompat (aka com.actech.android.frienchat:style/Base.V7.Theme.AppCompat) not found.

首先,我想澄清一下,我尝试了以下黑客攻击 -

1.清洁 - 重建

2.无效缓存重启

3.删除.idea文件夹

4.删除构建文件夹

5.更改appcompat版本

没有工作

这是我的build.gradle文件 -

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.actech.android.frienchat"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.firebase:firebase-core:16.0.5'
    implementation 'com.google.firebase:firebase-database:16.0.4'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-storage:16.0.4'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.firebase:firebase-config:16.1.0'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    implementation 'com.github.chrisbanes:PhotoView:2.1.3'
    implementation 'com.android.support:cardview-v7:27.1.1'

}

build.gradle(Project)

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

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.0.1'

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

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
}

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

非常感谢任何帮助(它充分证明几个月前我在android studio上成功使用了这个android项目)

android android-studio android-gradle android-build
1个回答
0
投票

好的,经过不同的试验和错误我发现了一个FIX,它应该是最简单的方法,当什么都没有工作!

使用默认设置启动新的Android Studio项目..

然后将新创建的项目的build.gradle(app和project)的常用内容复制并替换为Problematic项目,并同步

哪个应该可以解决所有这些错误(但请确保您已经尝试过问题中提到的黑客 - 这对我来说失败了并被迫找到这个新的解决方案......)

希望这将有助于将来面临任何这些问题的任何其他人。

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