gpt4 book ai didi

android - react native : compileDebugJavaWithJavac FAILED for

转载 作者:行者123 更新时间:2023-12-05 07:21:07 25 4
gpt4 key购买 nike

我一直收到错误compileDebugJavaWithJavac FAILED 我所有的模块。起初我以为它只是 AppSee,但它一直存在于我的所有模块中。

我已经尝试更新 Gradle 并确保我的所有版本都适合我的依赖项?

这是我的应用程序文件,缩减为重要部分

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
applicationId "com.kalleonative"
minSdkVersion 16
targetSdkVersion 28
versionCode 10
versionName "1.1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}

...
dependencies {
compile project(':react-native-contacts')
compile project(':react-native-vector-icons')
compile project(':react-native-firebase-analytics')
compile project(':react-native-fbsdk')
compile project(':react-native-push-notification')
compile ('com.google.android.gms:play-services-gcm:10.0.1') {
force = true
}
compile project(':react-native-config')
compile fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
//noinspection GradleCompatible
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-annotations:28.0'
compile "com.facebook.react:react-native:0.6.0" // From node_module
compile 'com.twilio:voice-android:2.0.0-beta14'
//noinspection GradleCompatible
compile 'com.android.support:design:28.0.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.koushikdutta.ion:ion:2.2.1'
compile 'com.google.firebase:firebase-messaging:19.0.1'
compile 'com.segment.analytics.android:analytics:4.4.0-beta1'
compile project(':react-native-immediate-phone-call')
}

这里是错误:

C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ContactsManager.java:26: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ContactsManager.java:27: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ContactsProvider.java:7: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ReactNativeContacts.java:3: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ContactsManager.java:924: error: cannot find symbol
protected static void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
^
symbol: class NonNull
location: class ContactsManager
C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ContactsManager.java:925: error: cannot find symbol
@NonNull int[] grantResults) {
^
symbol: class NonNull
location: class ContactsManager
C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ContactsProvider.java:239: error: cannot find symbol
@NonNull
^
symbol: class NonNull
location: class ContactsProvider
C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ReactNativeContacts.java:35: error: cannot find symbol
public static void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
^
symbol: class NonNull
location: class ReactNativeContacts
C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ReactNativeContacts.java:35: error: cannot find symbol
public static void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
^
symbol: class NonNull
location: class ReactNativeContacts
C:\Users\Jacob\kalleo\kalleo-master\kalleo-native\node_modules\react-native-contacts\android\src\main\java\com\rt2zz\reactnativecontacts\ContactsManager.java:921: error: cannot find symbol
ActivityCompat.requestPermissions(currentActivity, new String[]{PERMISSION_READ_CONTACTS}, PERMISSION_REQUEST_CODE);
^
symbol: variable ActivityCompat
location: class ContactsManager
10 errors

> Task :react-native-contacts:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.```

最佳答案

当我将“react-native-contacts”添加到我的项目时,我遇到了同样的问题。因为 'react-native-contacts' 现在支持 AndroidX,你必须:

  1. 将您的项目迁移到 AndroidX。 https://developer.android.com/jetpack/androidx/migrate
  2. 使用 Jetifier 将 node_modules 依赖项转换为 AndroidX。 https://github.com/mikehardy/jetifier#usage-for-source-files

试试吧!

关于android - react native : compileDebugJavaWithJavac FAILED for,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57081316/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com