gradle android在删除ACRA后找不到符号类AparresApi

nuypyhwy  于 2023-10-19  发布在  Android
关注(0)|答案(1)|浏览(130)

我需要删除ACRA以消除任何漏洞。我已经删除了app.gradle和MyApplication.java中的所有导入/编译。然而,当我尝试构建项目时,IDE给出了以下错误:

  1. error: cannot find symbol class RequiresApi

这是我的app.gradle和MyApplication.java
app.gradle(我在依赖项中删除compile 'ch.acra:acra:4.9.2'后无法构建)

  1. buildscript {
  2. (omitted)
  3. }
  4. apply plugin: 'com.android.application'
  5. android {
  6. compileSdkVersion 22
  7. buildToolsVersion '27.0.3'
  8. defaultConfig {
  9. applicationId "******"
  10. minSdkVersion 17
  11. targetSdkVersion 22
  12. versionCode 6
  13. versionName "1.0.3"
  14. }
  15. buildTypes {
  16. release {
  17. minifyEnabled false
  18. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  19. }
  20. }
  21. lintOptions {
  22. disable 'RestrictedApi'
  23. }
  24. }
  25. dependencies {
  26. implementation 'com.android.support.constraint:constraint-layout:1.0.2'
  27. compile fileTree(dir: 'libs', include: ['*.jar'])
  28. testCompile 'junit:junit:4.12'
  29. compile 'com.android.support:appcompat-v7:22.2.1'
  30. compile 'com.android.support:design:22.2.1'
  31. compile 'com.android.support:recyclerview-v7:22.2.1'
  32. compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
  33. compile 'com.google.zxing:core:3.2.0'
  34. compile 'com.jakewharton:butterknife:8.0.1'
  35. annotationProcessor 'com.jakewharton:butterknife-compiler:8.0.1'
  36. compile 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
  37. compile 'com.google.code.gson:gson:2.8.2'
  38. //compile 'ch.acra:acra:4.9.2' <- REMOVED ACRA
  39. compile "io.reactivex.rxjava2:rxjava:2.1.9"
  40. compile "io.reactivex.rxjava2:rxandroid:2.0.2"
  41. }

MyApplication.java

  1. package ******;
  2. import android.app.Application;
  3. public class MyApplication extends Application {
  4. private static MyApplication myApplication;
  5. public static MyApplication getInstance() {
  6. return myApplication;
  7. }
  8. public void onCreate() {
  9. super.onCreate();
  10. myApplication = this;
  11. }
  12. }

我也试过清理我的项目和重建,但没有工作。当我放回ACRA时,项目照常构建。是IDE的问题吗?

zy1mlcev

zy1mlcev1#

@RequiresApiandroidx.annotation:annotation的一部分。你必须把它作为一个依赖项
例如

  1. dependencies {
  2. implementation("androidx.annotation:annotation:1.3.0")
  3. }

相关问题