英文:
How to test a project downloaded from github in Android Studio
问题
我是新手使用Android Studio和Github,希望能得到一些指导。我想将一个Github项目包含到我正在构建的Android应用程序中并使用它的功能,但在将其链接到我的应用程序之前,我想先测试它。
这是我想在我的应用程序中包含的项目:
https://github.com/Philipinho/CoinGecko-Java
我已经成功将其作为新项目导入Android Studio,使用了“从版本控制中导入”菜单。现在我想测试测试目录中的代码,例如CoinsExample.java,但我不确定该怎么做。有没有办法我可以运行它,并在控制台中输出结果?
另外,我一直在阅读有关Gradle的内容,并想知道为什么这个项目没有一个gradle文件?如果我想将它添加到我自己的Android应用程序项目中,我需要吗?
谢谢阅读
David
英文:
Im new to Android Studio and Github and would like some guidance. I am wanting to include a github project into a Android app i am building and use its functions, but want to first test it before linking it to my app
This is the project i want to include in my app:
https://github.com/Philipinho/CoinGecko-Java
i successfully imported its as a new project in Android Studio using the Import from Version Control menu. I now want to test the code in the test directory e.g. CoinsExample.java, but im not sure what to for that. Is there a way i can just run it and output the results in a console?
Also ive been reading about Gradle, and wonder why this project does not have a gradle file? Will i need it if i want to add it to my own Android app project?
Thank you for reading
David
答案1
得分: 0
这个存储库不包含 Android 应用程序。它是一个使用 Maven 构建的 Java 库。test\....
目录中的所有文件都有 main()
方法,因此您可以单独运行它们。(我不确定您是否可以在 Android Studio 中运行它们,但您可以在 Eclipse 或任何其他 Java IDE 中运行它们。)如果您想在您的 Android 应用程序中使用它,您应该首先将以下内容添加到您的根 build.gradle
:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
然后您可以将此依赖项添加到您的项目中:
dependencies {
implementation 'com.github.Philipinho:CoinGecko-Java:e5a72c7083'
}
英文:
This repository does not contain an Android application. It is a Java library built with Maven. All files in test\....
directory have the main()
method so you can run them separately. (I'm not sure if you can run them in Android Studio but you can run them in Eclipse or any other Java IDE) If you want to use it in your Android application, you should first add this to your root build.gralde
:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
then add you can add this dependency to your project :
dependencies {
implementation 'com.github.Philipinho:CoinGecko-Java:e5a72c7083'
}
答案2
得分: 0
你刚在Github上发现了一个很酷的库,想在你的手机上测试它,需要做以下步骤:
- 点击下载zip文件
- 解压缩zip文件
- 打开Android Studio
- 导入刚刚下载的项目
- 同步gradle
- 运行项目
- 选择你想要运行的设备
- 尽情进行测试
- 当你不再需要时,删除项目文件夹和zip文件
或者,你可以直接使用dryrun。
英文:
You just came across a cool library on Github, what do you need to do to test it on your phone?
- Click the download zip
- Extract the zip file
- Open Android Studio
- Import the project you just downloaded
- Sync gradle
- Run the project
- Choose the device you want to run
- Test all you want
- Delete the project folder and the zip file when you don’t want them anymore
Or, you can simply use dryrun
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论