I have created android library project with some depndencies managed by maven.
Now I'm trying to run library code from android maven application project.
Code I wrote in library runs, but I'm getting NoClassDefFoundError on first call to dependecy.
Is there any way to make this work?
You may want to have a look at http://androidkickstartr.com/. This tool will create correctly mavenized project for you and you can then copy missing parts from pom.xml.
Related
I'm trying to build an AR project in Unity and use it as a library in my native android app.
I used this article as a guideline:
https://medium.com/#davidbeloosesky/embedded-unity-within-android-app-7061f4f473a
I successfully imported the project to Android Studio, but the settings.gradle file is missing.
Although I can run the project from the studio, when I convert it to a library and use its aar file in my native android app - I fail to build the project.
Has anyone succeeded doing it?
I followed the guideline and it worked out. I put the .aar file below the native app libs file. In app build.gradle, under dependencies add:
implementation(name:"AndroidPluginDemo",ext:"aar")
and under android add
repositories {
flatDir {
dirs 'libs' //this way we can find the .aar file in libs folder
}
}
Just to add on to the above answers asking about the camera not working, the problem for me was the one of the classes in the unity app wasn't being found when i imported that library into my android app.
When you're converting the application to a library project, take note in the build.gradle of the dependencies.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(name: 'vlsdk', ext:'aar')
}
In my case I had to find the 'vlsdk.aar' file that was being referenced, and import that as a new module (as is done in step 6 of the tutorial) into my native android app. Hope this helps.
I know this is very old and i hope you have found a solution. but to anyone else facing this issue.
Add the ".aar" libraries found in the libs folder of unity's exported project to the build.gradle file as dependencies(they also need to be physically present in the native projects libs folder).
In my case when i built the .aar library from the exported project it did not add the dependencies(unity exported project also has dependencies found in the libs folder). I only excluded the "unity-classes.jar" file as my unity code is already in the ".aar" that i created.
Check the following link
https://medium.com/#randive.rishiraj/7-steps-to-integrate-google-arcore-unity-project-to-a-native-android-app-d85793ba0b37
Hope this helps.
To implement Unity features inside native apps we need to change Unity Project as a library, and then integrate inside our native application.
From version 2019.3.a2 Unity introduced a new feature Unity as a library in native apps both Android and Ios.
Steps:
1. Export Unity Project as an Library (Android)
2. Add Unity Library Module inside Native Android Project
3.Show Unity View inside Android Activity
Previously, the exported Unity project will have only one gradle module and one manifest file.
But now the Structure has been changed to two gradle modules.
1. launcher
2.unityLibrary
Both launcher and unityLibrary module will have its own build.gradle and manifest files.
unityLibrary - module will have Unity runtime and project data, it can be easily integrated into any other gradle project. It will help
to integrate Unity inside our native android project.
launcher - module will have all icons and the application name.
But we want use only unityLibrary module as an library inside our native android project.
This blog helps to implement unity view in your native android app.
https://navinkumar0118.medium.com/show-unity-view-inside-native-android-app-8035b9b6895a
I am trying to use Codenvy to develop, and I am switching from Android Studio. I am in the middle of a project. How can I transition? Can I use a special import feature? I have already tried to copy and paste the code, but a lot of libraries don't seem to be there. If you need to take a look at my source code, then just search up "calc-nigma" in Github search and you can click on the option that is made by beekaydev.
Thank you in advance.
The Problem is not with your code but the dependencies Codenvy is using is Maven while it seems that your application may be using Gradle dependencies.
For the Support of Answer:
Maven uses pom.xml file to build your project.
Gradle uses build.gradle file to build the project.
If you want to move your project to Codenvy try migrating your Gradle build to Maven build using this thread Migrating Gradle build.gradle to Maven pom.xml.
Hope this Helps!
I've been trying to add the volley library to my android project by downloading this repository https://android.googlesource.com/platform/frameworks/volley and then importing the module to my project by following this guide:
First get latest volley with git (git clone >https://android.googlesource.com/platform/frameworks/volley).
In your current project (android studio) click [File] --> [New] -->[Import >Module].
Now select the directory where you downloaded Volley to.
Now Android studio might guide you to do the rest but continue guide to verify >that everything works correct
Open settings.gradle (find in root) and add (or verify this is included):
include ':app', ':volley'
Now go to your build.gradle in your project and add the dependency:
compile project(":volley").
When gradle tries to sync the project after I've imported the module i get the following error message : Error:Could not download layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:24.3.1): No cached version available for offline mode.
I believe you want to use Volley and not contribute to the volley library. if that is the case there are better ways to get volley in your project. let Gradle handle it. Gradle is Build Management tool just like Maven but better, As it gives you more freedom and flexibility.
How to add libraries to gradle in android studio. this link shows a how to add libraries to your android project.
As Android Studio uses Gradle things are pretty neat as it uses the middle ground of ANT and Maven for Build and Management tool.
for volley you can add
compile 'com.mcxiaoke.volley:library:1.0.19'
to the app module of your project. this library can be looked up on Github
or you can do that using android studio's GUI, click on File -> Project Structure
example
Ok, so, I'm developing an app for the Amazon FireTV, so I have to use Eclipse.
I'm trying to use this socket.io Java client library: https://github.com/nkzawa/socket.io-client.java
at the bottom of this post, i included the installation instructions, which I'm not really sure how to make work with my existing Eclipse project (I'm new to maven). so from my understanding, do i just add a pom.xml file and a test folder? Then paste in their "maven central code" into the pom.xml? Will this cause any issues with the other code in my project? Or, can I just copy and paste all their SRC code into my project, since it's MIT licensed? I'd rather learn how to do this the proper way. The project is not in JAR format, so I was thinking maybe copying the folder structure into my project then using the Project Properties, Add Library option to connect to my code? Maybe?
Their installation instructions, (available in their readme.md):
The latest artifact is available on Maven Central. Add the following dependency to your pom.xml.
<dependencies>
<dependency>
<groupId>com.github.nkzawa</groupId>
<artifactId>socket.io-client</artifactId>
<version>0.3.0</version>
</dependency>
</dependencies>
Or to install it manually, please refer dependencies to pom.xml.
Add it as a gradle dependency for Android Studio, in build.gradle:
compile 'com.github.nkzawa:socket.io-client:0.3.0'
So, I learned that Maven Central has JAR files available for download. That way, you can just include them in your project via the Project Properties dependencies options. Without having to learn Maven.
You need to first understand how Maven works (and what pom.xml stands for). Maven is a tool that helps you automatically install dependencies (files need) for a given project. E.g if a project needs to process json files, it will need to "import" a json library which will then be a dependency for that project. When you add the dependency file above to your project, and run Maven install, it goes and fetches all the dependencies for your socket.io-client to work.
Unfortunately, Maven does work very well in building android application projects and can be fairly complex to setup correctly (from my limited experience). I would advise that you manually download the jar dependencies and then add them to your android classpath if you are not keen on investing a lot of time learning to use Maven.
To manually install the files .. you can create a default maven project (http://www.tech-recipes.com/rx/39279/create-a-new-maven-project-in-eclipse/) in eclipse, add the dependency file above to your pom.xml and run Maven-install. This will download the dependencies you need to your Maven local repository. You can then copy them from there to your android project.
Regarding installing the socket.io client you can find more on these steps here
http://denvycom.com/blog/socket-io-java-android-without-maven/
I created Android Maven Project with android-quickstart-archetype ( https://github.com/akquinet/android-archetypes/wiki/android-quickstart-archetype )
I need to use Robotium ( http://code.google.com/p/robotium/ ) GUI Unit testing library.
I added dependencies in pom.xml.
How can i implement this library in my project. Can anybody helps me?
To implement Robotium in Android Maven project you need to:
Add dependency in pom.xml. Dependensy you can get here: http://code.google.com/p/robotium/wiki/Maven
Use android-with-test archetype. https://github.com/akquinet/android-archetypes/wiki/android-with-test-archetype
From the link:
Getting started
...
When you have created a new test
project you need to add the Robotium
jar to the build path. In Eclipse that
is done by right clicking on the test
project --> Properties --> Java Build
Path --> Add (external) Jar.
Basically, to get the library running in your project, you simply need to add the jar to the classpath.