Trouble importing and running the Google Cardboard sample project - java

You can find the project here: https://github.com/googlesamples/cardboard
The last time I worked with android was about a year ago and I'm trying to use this VR project to get back into it. All I want to do is mess around with the app to get a feel for it.
However, I haven't been able to get it running. I installed a fresh copy of Eclipse (juno) with the JDK and android SDK and got the android 4.4W stuff from the SDK manager. I also made a Nexus 5 AVD.
My problem is that I've tried choosing multiple 'root' folders to 'import as existing android project' and none of them have been runnable. Each time the eclipse terminal gives an 'Installation error: Unknown failure' error after installing 'MainActivity.apk'.
I figured the 'main' folder would be most likely to work since it has the manifest and all the other folders associated with android projects.
How do I get it running?

#CommonsWare: I have the project up and running on Eclipse(Juno) with Android 4.4.2
#ThroatOfWinter: These steps should help you. They worked for me.
Download the project from github as a ZIP file
Extract the contents of the ZIP file (named cardboard-master) into a folder and then import the whole folder into Eclipse as a new android project
Create a new "libs" folder in your project
To use the Cardboard API, download the VR Toolkit .jar file and include it in your project in the "libs" folder.
If everything has worked fine so far, you'll find that the "src" folder in your new Cardboard project is empty but the "java" folder contains 3 .java files.
Create a new package in "src" called "com.google.vrtoolkit.cardboard.samples.treasurehunt"
Copy the 3 files from the "java" folder and paste in the package you created in the previous step.
Clean and build the project
Test on an android device (preferably) with the cardboard app installed
You shouldn't need to edit the manifest at all.

That is not an Eclipse project. It is for use with Android Studio and Gradle. Your choices are:
Switch to Android Studio, or
See if somebody else has already reorganized that code into an Eclipse project, or
Attempt to reorganize it yourself, moving the contents of src/main/ into appropriate locations and fixing up the manifest for things that are set now in build.gradle, or
Find something else as a project to get back into Android development

This alternative worked for me: https://github.com/raasun/treasurehunt
It's pretty much the same as the Cardboard sample project from Google except that it's compiled with Eclipse/ANT instead of Android Studio/gradle.
Just follow the first part of moyheen's instructions to set it up.

To make it work on Eclipse, I just placed the Cardboard API jar (cardboard.jar) at the root folder of my app (alongside AndroidManifest.xml), and then in Build Path dialog I just did "Add Jar" and selected cardboard.jar.
Warning: Placing cardboard.jar in libs/ folder won't work, I tried, and it will produce an invalid APK that can't be installed.

Related

How can I restore my Android Studio project?

I changed the name of the Android Studio project folder in the Windows Explorer before I started Android Studio. Bad idea.
Now I get the error:
Gradle sync failed: No toolchains found in the NDK toolchains folder for ABI with prefix: mipsel-linux-android
And all my Activity files are replaced with one MainActivty that doesn't contains the things I've made.
Unfortunately I can't get a previous version with "show history" in Android Studio and i can,t get an older version via windows explorer "restore previous version"
I also tried to decompile it from the .apk on my phone. I got the layout and xml files but can't find my java classes.
I worked since weeks on this project and don't want to lose it.
Can anyone help me either fix the error or restore the .apk?
Thanks so much for all suggestions and ideas
First close the broken project this can be done with File > Close project
Then you have to reopen the project from the new location ie. the renamed folder.
File > Open... browse in your filesystem for the project, select the folder and press OK
Wait for the gradle to sync and hopefully you won't have any problems!
I have the same problem when updating ndk-18. You updated the NDK to version 18 and it is missing the folders/files. You can download ndk-v17 manually and extract the search folder "toolchains" to copy the missing folders/files to your folder android-sdk/ndk-bundle.
From github.

Change Arr file then include it in Android Studio

I got some arr file that I need to change. It is https://github.com/BlinkID/blinkid-android library and I need to change something in xml file (values directory) to make it work and include it in my project in Android Studio. This is what I did ( I tryed other ways too but without success):
Changed arr extension to zip
extracted it with WinRAR
made changes to xml
Packaged it again and changed to arr extension again
In android studio I went File->New->New module->Import JAR/ARR Package.
If it is not added automatically I would add compile(:LibBlinkId) to gradle
Unfortunatelly when I start typing com.microblink... I don't get intellisense, meaning that library was not added. Also I tryed to rename it to .jar file, then added it to libs directory and go to : File->Project Structure-> selected my app module and added that jar, then in gradle I put something like compile files('libs/LibBlinkID.jar')
That did not help also.
After changing your build.gradle you should also do a Sync Project with Gradle Files.
If there were no errors during this step, I see no reason why your method wouldn't work except for the fact that on step 6 it should be:
dependencies {
compile project(':LibBlinkId')
...
}
If Android studio somehow failed to sync up to your dependencies you might want to try an Invalidate Caches / Restart from the File menu and follow that with a project rebuild.
Update:
If that still does not work but the project builds successfully, try to manually import a known class from the AAR and to use that class in a small piece of code. Then run your app.
When dependency import failures happened to me, after such a manual step Android Studio autocomplete would start to work and give me the correct suggestions.

Addons folder missing in Android SDK

I am new to android development. I was going through this Guide to setup a roboelectric test project. In one of the steps, we need to add maps.jar as dependency to the project. The maps.jar is usually located inside addons folder in SDK directory.When i tried to locate the maps.jar in my SDK directory, I found that addons folder is not there. Is there any way to get it ?
I am using Eclipse Juno
I have finally figured out the reason , why i dont have the addons folder inside my SDK directory. It is because, i have not downloaded even a single Google API's of any version of android in Android SDK Manager.Finally fixed it by downloading Google API's for the required android version.
There was another question similar to this:
importing jar libraries into android-studio
To quote ant2009 from that question:
This was actually fixed with the new updated 0.2.8 version. All I did was create a new directory called 'libs' Dragged the jar file into it. Right click the jar file 'Add as library'. This will expand the jar file. Entered this into the build.gradle file 'dependencies { compile files('libs/jtwitter.jar')}. Entered the import statement to bring the classes into my source file. Everything worked fine. – ant2009 Sep 19 '13 at 6:33
Hope that helps.

LibGDX project can't find assets folder

I have suddenly run into an issue with my build environment and I can't figure out why. I can run my project just fine using gradlew desktop:run however, when I try to run the project from Eclipse using right-click run as desktop application (on the desktop project of course) it suddenly cannot find my pack.atlas file. There is no doubt the file exsts. I have refreshed my eclipse project multiple times and the project runs fine using gradle commandline. It was working fine yesterday. The only thing I can think of that made it mess up was I ran a Gradle command from within the IDE yesterday but I'm not sure how it could have got messed up like this. It is important for me to figure out this issue as I cannot use the Eclipse debugger with this error. Does anyone have any guess as to why Eclipse isn't seeing the assets folder?
Probably your assets from the android project is not correctly linked with the desktop project.
Your linked assets folder from inside the desktop project should look like this:
If it doesn't(or it doesn't exists) ,delete the folder(in the desktop project),and go to the the project properties->java build path->source->link source
browse->[select the asset folder inside the android project]->finish

After creating android project in Eclipse ADT, tons of errors show up

I'm using eclipse ADT (most recent version) to develop some android apps. I've followed the getting started tutorial at the dev.android.com and it worked just fine.
But when i tried to create another project with the same targets and sdk's, i've got nothing but errors:
Some errors and my sdk's:
That's the same sdk's i used before these errors started showing up.
What can be causing this?
EDIT: my project won't generate the R.java file
You might need to add a support library to your new project.
Check this link for downloading the support libraries -
http://developer.android.com/tools/support-library/setup.html#download
Please notice that you need to import them into your eclipse and then include one (preferably the newest, not sure about this) in your project.
EDIT:
Before downloading the support libraries you should first check if you have them already.
Try this, right click project folder in the eclipse package explorer, Properties>Android>Library>Add>select a library if you have one.
There might be an invalid library included in your project already, if that happens then you will see it in the Library>Add> menu, remove it and add a new one.
You might have clean your project ........
if yes.....you must check whether R.java file is present in **Project(your project)->gen->package name->R.java**
if not than u have to update Tool Folder in SDK manager

Categories

Resources