android - 无法使用 react-native 为 android 构建

标签 android react-native android-gradle-plugin

我正在尝试运行 react-native run-android 但我不断收到此错误。我正在 emulator 上运行。我使用 react-native init 启动了应用程序。

PS:我在代理上运行。

当我想跑的时候

react-native run-android

我得到:

FAILURE: Build failed with an exception.

*  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:gradle:2.2.3.
 Required by:
     :AwesomeProject:unspecified
  > Could not resolve com.android.tools.build:gradle:2.2.3.
     > Could not get resource 'https://jcenter.bintray.com/com/android/tool
/build/gradle/2.2.3/gradle-2.2.3.pom'.
        > Could not GET 'https://jcenter.bintray.com/com/android/tools/buil
 /gradle/2.2.3/gradle-2.2.3.pom'. Received status code 407 from server: 
 Proxy Authentication Required

当我想运行的时候

directly in Android Studio

我得到:

Error:Could not GET 
'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-
2.2.3.pom'. Received status code 407 from server: Proxy Authentication 
 Required
<a href="toggle.offline.mode">Enable Gradle 'offline mode' and sync 
project</a>

我已经安装了我的 node_modules,但我不确定还能尝试什么,过去 4 个小时我一直在谷歌搜索,但一无所获。

最佳答案

在 sdk 管理器中设置您的代理详细信息

AndroidStudio->tools->Android->SDKManager->system settings->Http Proxy

关于android - 无法使用 react-native 为 android 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46771053/

相关文章:

android - PagerTabStrip - 在屏幕上显示所有选项卡,就像正常的操作栏选项卡实现一样?

reactjs - React-native-navigation 导航时更改屏幕方向

javascript - React Native : Array. map 未在 Scrollview 中呈现

android - Gradle clean 任务因未解析所有依赖项而失败

android - Gradle 错误 : More than one variant of project :myModule matches the consumer attributes after upgrading to new Google Services

java - 解析 JSON 数据时应用程序崩溃

java - 如何正确更新textView?

java - android手机 hibernate 时保持wifi连接

android - 无法解析符号 ReactApplication/ReactNativeHost

android - SonarQube - Android 不适用于 gradle 3.0.0