Inz*_* IT 9 android android-appcompat gradle android-studio androidx
我将构建和目标版本更新为28(Pie),并替换了相关的依赖项。现在我的项目说在上找不到符号AppCompatActivity
。我试图
但是结果是一样的。而且,当我在活动类中的extends关键字之后尝试Ctrl+时Space,没有任何"AppCompatActivity
建议。我试图调查它是否存在于libraries
文件夹中,是否存在于文件夹中。
现在,我应该怎么做才能使其正常工作?如果库有任何变化/替代,androidx
请告诉我。这是我的完整build.gradle
文件
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.invogen.messagingapp"
minSdkVersion 16
targetSdkVersion 28
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(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:design:28.0.0'
// implementation 'com.android.support:support-v4:28.0.0'
// Libs for newer API 28
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'
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'
// Libs for Firebase Functionality
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-auth:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.4'
// Lib for Firebase UI Elements
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
// Libs for QR Code
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
// Lib for Circle Image View (Profile Image)
implementation 'de.hdodenhof:circleimageview:2.2.0'
// Lib for Loading Images
implementation 'com.squareup.picasso:picasso:2.71828'
//Lib for Cropping Images
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
其他一些帖子建议在Manifest
文件中添加以下两个参数
android:appComponentFactory="anystrings be placeholder"
tools:replace="android:appComponentFactory"
Run Code Online (Sandbox Code Playgroud)
但是由于这两行项目同步出现多个错误,Android Studio说
编译失败;有关详细信息,请参见编译器错误输出。
如果我必须为问题添加更多细节,请告诉我。
iam*_*cxl 16
您应该替换目标类。
例如。
import android.support.v7.app.AppCompatActivity;
Run Code Online (Sandbox Code Playgroud)
替换为:
import androidx.appcompat.app.AppCompatActivity;
Run Code Online (Sandbox Code Playgroud)
小智 5
在你的 gradle 属性中添加以下行:
android.useAndroidX=true android.enableJetifier=true
这会将您的项目升级到 Android X。
归档时间: |
|
查看次数: |
14493 次 |
最近记录: |