在运行应用时反映原生Android错误

时间:2018-02-19 09:36:14

标签: android react-native

我尝试在我的反应原生项目中构建本机代码在Mac OS X El Capitan上命名为AwesomeProject。 事情很好,直到 react-native init

在终端上执行 react-native run-android 后,我收到此错误 -

* What went wrong:
    A problem occurred configuring root project 'AwesomeProject'. >
    Could not resolve all dependencies
for configuration ':classpath'. >
    Could not resolve com.android.tools.build: transform - api: 2.0 .0 - deprecated - use - gradle - api.
Required by:
    : AwesomeProject: unspecified > com.android.tools.build: gradle: 2.2 .3 > com.android.tools.build: gradle - core: 2.2 .3 >
    Could not resolve com.android.tools.build: transform - api: 2.0 .0 - deprecated - use - gradle - api. >
    Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.pom'. >
    org.apache.http.ssl.SSLInitializationException: /Library/Java / JavaVirtualMachines / 1.6 .0.jdk / Contents / Home / lib / security / cacerts(No such file or directory) >

我还需要安装其他东西吗?有没有人发现这个问题? 如果我尝试在Android Studio上使用 gradle:2.2.3 来制作原生Android应用,那么它可以正常使用。

1 个答案:

答案 0 :(得分:2)

看起来使用JDK 6是个问题。我现在已经安装了Java SE Development Kit 8,它运行正常。 React native需要JDK 8或更高版本。