- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要删除 ACRA 以消除任何漏洞。我已经删除了 app.gradle 和 MyApplication.java 中的所有导入/编译。但是,当我尝试构建项目时,IDE 给出以下错误:
error: cannot find symbol class RequiresApi
这些是我的 app.gradle 和 MyApplication.java
app.gradle(删除依赖项中的 compile 'ch.acra:acra:4.9.2' 后无法构建)
buildscript {
(omitted)
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "******"
minSdkVersion 17
targetSdkVersion 22
versionCode 6
versionName "1.0.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'RestrictedApi'
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.journeyapps:zxing-android-embedded:3.0.1@aar'
compile 'com.google.zxing:core:3.2.0'
compile 'com.jakewharton:butterknife:8.0.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
compile 'com.google.code.gson:gson:2.8.2'
//compile 'ch.acra:acra:4.9.2' <- REMOVED ACRA
compile "io.reactivex.rxjava2:rxjava:2.1.9"
compile "io.reactivex.rxjava2:rxandroid:2.0.2"
}
我的应用程序.java
package ******;
import android.app.Application;
public class MyApplication extends Application {
private static MyApplication myApplication;
public static MyApplication getInstance() {
return myApplication;
}
public void onCreate() {
super.onCreate();
myApplication = this;
}
}
我也曾尝试清理我的项目并重建,但没有成功。当我放回 ACRA 时,项目会像往常一样构建。是IDE的问题吗?
最佳答案
@RequiresApi
是 com.android.support:support-annotations
的一部分。您必须将其添加为依赖项
例如
dependencies {
com.android.support:support-annotations:27.1.1
}
关于删除 ACRA 后,android 找不到符号类 RequiresApi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50691540/
在我的 Flutter 应用程序中,我经常使用 Connectivity plugin检查主机设备的当前在线状态。直到最近,这一直工作得很好。但是,随着最新的 Flutter 升级版本 1.22.2,
RequiresApi 和 TargetApi 有什么区别? kotlin 中的示例: @RequiresApi(api = Build.VERSION_CODES.M) @TargetApi(Bui
我需要删除 ACRA 以消除任何漏洞。我已经删除了 app.gradle 和 MyApplication.java 中的所有导入/编译。但是,当我尝试构建项目时,IDE 给出以下错误: error:
作为https://developer.android.com/reference/android/support/annotation/RequiresApi.html说 support-annot
为了抑制 API 级警告,我通常更喜欢使用 @RequiresApi,而不是 @TargetApi。 因为,根据 RequiresApi vs TargetApi android annotation
我是一名优秀的程序员,十分优秀!