[英]run a sample android Project
When I download an Android project, I don't know how I can run it. 当我下载Android项目时,我不知道如何运行它。 As an example I've downloaded this project 作为一个例子, 我已经下载了这个项目
When I open it Android Studio says that: 当我打开它时,Android Studio说:
After clicking the Configure
button I see only: 单击Configure
按钮后,我只看到:
After clicking OK
button, I can see the project structure and there is no any error. 单击OK
按钮后,我可以看到项目结构,没有任何错误。
However, I cannot build or run this project. 但是,我无法构建或运行此项目。
How can I do this? 我怎样才能做到这一点?
Thank you very much for your time and assistance in this matter. 非常感谢您在这件事上的时间和帮助。
Error:Android Source Generator: Error: Can't find bundle for base name messages.AndroidJpsBundle, locale en_US
java.util.MissingResourceException: Can't find bundle for base name messages.AndroidJpsBundle, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:773)
at org.jetbrains.jps.android.AndroidJpsBundle.getBundle(AndroidJpsBundle.java:22)
at org.jetbrains.jps.android.AndroidJpsBundle.message(AndroidJpsBundle.java:32)
at org.jetbrains.jps.android.AndroidSourceGeneratingBuilder.runAaptCompiler(AndroidSourceGeneratingBuilder.java:971)
at org.jetbrains.jps.android.AndroidSourceGeneratingBuilder.doBuild(AndroidSourceGeneratingBuilder.java:210)
at org.jetbrains.jps.android.AndroidSourceGeneratingBuilder.build(AndroidSourceGeneratingBuilder.java:114)
at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1263)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:940)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1012)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:903)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:736)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:384)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:192)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:295)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:236)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Some Projects given by the guides are older and donnt have the gradle configuration to run properly on the newest version of Android Studio. 这些指南提供的一些项目较旧,并且没有gradle配置可以在最新版本的Android Studio上正常运行。
The recommendation is never try to open in a normal way!!. 建议永远不要试图以正常方式打开!! You need import all the projects that you download, in that way Android Studio check and override configurations in project to run/Build properly. 您需要导入您下载的所有项目,以便Android Project检查并覆盖项目中的配置以正确运行/构建。
I try import this porject and is working fine. 我尝试导入这个项目并且工作正常。 All you need to do is Import and accept the sugestion that Android Studio popup to Update gradle. 您需要做的就是导入并接受Android Studio弹出到更新gradle的消息。
EDIT: 编辑:
You can import in 2 ways. 您可以通过两种方式导入。
Important !! 重要!! Select folder project. 选择文件夹项目。
First window to select Project in AS. 在AS中选择Project的第一个窗口。
And the other way is when you have open the project just go File>New>Import Project 另一种方式是当你打开项目时,只需转到文件>新建>导入项目
This is probably because you have not yet told Android Studio what to run/how to run. 这可能是因为您还没有告诉Android Studio运行什么/如何运行。 Go to run->run...->app and then you will have to select an emulation device to run it on. 转到run-> run ...-> app然后你必须选择一个仿真设备来运行它。
Restart android studio and Import the project OR give a try to these steps: 重新启动android studio并导入项目或尝试以下步骤:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.