相关疑难解决方法(0)

无法解析符号'AppCompatActivity'

我刚刚尝试使用Android Studio.我创建了空白项目并试图创建Activity扩展AppCompatActivity.不幸的Android Studio"说"它

无法解析符号'AppCompatActivity'

我有 compile "com.android.support:appcompat-v7:22.0.+"我的"app"模块的依赖列表和重建项目几次.但是我只能使用ActionBarActivity.我究竟做错了什么?

android android-appcompat gradle android-support-library android-studio

204
推荐指数
15
解决办法
27万
查看次数

BottomNavigationView迁移到androidx后会膨胀错误

当我尝试启动我的应用程序时,我的Mainactivity在“ setContentView(R.layout.activity_main);”处的oncreate()方法中引发此错误

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sanchez.worldgramproject/com.example.sanchez.worldgramproject.Fragments.MainActivity}: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class android.support.design.widget.BottomNavigationView
Run Code Online (Sandbox Code Playgroud)

迁移到androidx后出现此错误,经过进一步检查,我注意到Bottomnavigationview类中的import语句已过时(不是androidx格式,而是旧格式)。Bottomnavigationview类文件是只读的,因此我无法对其进行编辑。

摇篮:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.example.sanchez.worldgramproject"
        minSdkVersion 21
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 0
        versionName "0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
}



dependencies {

    compile fileTree(dir: 'libs', include: ['*.jar'])

    implementation …
Run Code Online (Sandbox Code Playgroud)

android appcompatactivity androidx

6
推荐指数
1
解决办法
2200
查看次数

'错误:无法解决:com.android.support:appcompat-v7:29.0.1'

我想尝试Intellij平台进行android开发,但是即使重新启动它也显示gradle失败。请帮忙。

我试图调整线

implementation 'com.android.support:appcompat-v7:29.+'
Run Code Online (Sandbox Code Playgroud)

到其他版本,但无济于事。

这是我的模块级gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:29.+'
    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'
}
Run Code Online (Sandbox Code Playgroud)

这是我的项目级别Gradle

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

buildscript {
    repositories {
        google() …
Run Code Online (Sandbox Code Playgroud)

android intellij-idea build-tools gradle appcompatactivity

5
推荐指数
1
解决办法
1285
查看次数