设置第一个Android Hello World

时间:2016-12-22 15:11:07

标签: android

我正在尝试使用带有android Nexus 5 API 22的AVD模拟器在Android Studio上设置我的第一个Hello World模拟器运行,我相信我的应用名为'design'应该在应用列表中,但不是。 Gradle的错误消息是:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugUnitTestApkCopy'.
   > Could not resolve junit:junit:4.12.
     Required by:
         Design:app:unspecified
      > No cached version of junit:junit:4.12 available for offline mode.

Information:BUILD FAILED

Gradle的事件日志读取:

5:38:03 PM Gradle sync started
5:38:15 PM Gradle sync completed
5:50:59 PM Executing tasks: [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
5:52:03 PM Gradle build finished with 1 error(s) in 1m 9s 632ms
5:52:03 PM Unresolved Dependencies
           Unresolved dependencies detected while building project in offline mode. Please disable offline mode and try again.
           Disable offline mode
5:52:37 PM Executing tasks: [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
5:52:39 PM Gradle build finished with 1 error(s) in 2s 99ms
5:52:39 PM Unresolved Dependencies
           Unresolved dependencies detected while building project in offline mode. Please disable offline mode and try again.
           Disable offline mode

运行日志读取:

Hax is enabled
Hax ram_size 0x40000000
HAX is working and emulator runs in fast virt mode.
Warning: requested ram_size 1536M too big, reduced to 1024M
emulator: Listening for console connections on port: 5554
emulator: Serial number of this emulator (for ADB): emulator-5554
emulator: emulator window was out of view and was recentered

1 个答案:

答案 0 :(得分:2)

缺少所需的文件,根据日志,您在离线模式下使用Gradle 转到File -> Settings。在Gradle下选择Build, Execution, Deployment,然后取消选中Offline work。它将下载丢失的文件。