Author Topic: samples under latest Android Studio  (Read 1555 times)

Offline Varanda

  • byte
  • *
  • Posts: 27
    • View Profile
samples under latest Android Studio
« on: March 11, 2016, 03:07:20 pm »
I really like everything I learned so far about this engine. A show stopper is the mess that Android did with this grable. I tried for 6 hours to get Bones and Ninja demos and so far no luck.

I tried using the AS project. It complains about missing android 4. Downloaded Android 4 and still no luck. Hacked the grable to set another API level, no luck. Tried to import Eclipse project. After many hacks still does not work. Tried to create a brand new project and move the java and libs. No luck either.

I completely acknowledge that all this nightmare is Google's mess. But it is being a show stopper for me. I would suggest to have contributors sharing successful projects for the latest AS for key features sample code. Otherwise, more people may give up for the stupid removal of gnumake and a gradle which does not provide any real and meaningful error messages.
« Last Edit: March 11, 2016, 03:56:26 pm by Varanda »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: samples under latest Android Studio
« Reply #1 on: March 11, 2016, 04:10:39 pm »
I would setup a clean project in AS 2.0 and import the stuff that you need. That said, I gave the Bones demo project for AS a try in AS 2.0.

And yes, it doesn't work out of the box, but it wasn't too complicated to fix that in my case. I did this:

  • Opened the project
  • Deleted the .gradle directory
  • Opened the build.gradle file and replaced the entire content with...

...this:
Code: [Select]
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

(I took this right from a clean and empty project)

Rebuild the project. It then complained about some missing tools and such, but it always offered the option to fix this by downloading the missing parts right away. I also had to configure the path to Java, but again, it asked me about it directly, so that was more or less foolproof.

...Oh, and I had to rename the file ninja.group.bones to something without the dots. And so I had to change two lines in the sources that load this file.

Yes, AS sucks and gradle even more. But I can't say that it was imposibble to get the project up and running. It took me around 10min. I don't think that zipping that stuff would really help, because I don't think that you can simply unzip and run it on another setup...just like to can't with the current AS demo project.

Offline Varanda

  • byte
  • *
  • Posts: 27
    • View Profile
Re: samples under latest Android Studio
« Reply #2 on: March 11, 2016, 04:13:47 pm »
Thanks a lot, I will try that tonight.
Your support is amazing... that motivates me (and people) to stick with this jPCT.

Cheers,
Varanda

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: samples under latest Android Studio
« Reply #3 on: March 11, 2016, 04:42:39 pm »
I hope it helps, but don't be surprised if everything is different on your machine... ;)

As said: I think the best way would be to start with a clean project. That shouldn't be too hard either. Just add the jpct-ae and bones libs to the project, place the needed files in res/raw and create a new class file that contains the Activity.

Offline Varanda

  • byte
  • *
  • Posts: 27
    • View Profile
Re: samples under latest Android Studio
« Reply #4 on: March 11, 2016, 04:49:34 pm »
Thanks. I tried starting with a clean prj and bring java and libs one by one and making the adjustments. However, I keep getting:

Error:Execution failed for task ':app:mergeDebugResources'.
> java.lang.ArrayIndexOutOfBoundsException (no error message)

Which does not provide a meaningful clue (at least for me) where the problem is located.

Anyways... I will retry tonight or tomorrow morning. If you can zip and send to ma, even if it does not work, at least I can check the diff about the changes you have done.

my email: cglabs@mail.com (mail, not gmail).

Thanks a lot,
Varanda

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: samples under latest Android Studio
« Reply #5 on: March 11, 2016, 05:04:11 pm »
Can't do that during the weekend, because I don't have access to the machine on which I did that, I'm afraid.

That exception is strange...have you tried to install AS again? Also make sure that you have the JDK installed and not just the JRE.

Offline Varanda

  • byte
  • *
  • Posts: 27
    • View Profile
Re: samples under latest Android Studio
« Reply #6 on: March 12, 2016, 02:07:28 am »
Finally I have that BonesDemo project working with the latest AS.

Maybe the major change was issuing "./grablew clean" and got lost of updates which may have fixed that exception.

In case anyone needs it:
https://www.dropbox.com/s/6n9dchnlaz2fue7/BonesDemo.zip?dl=0

About the Bones-Android-Ninja I followed similar workflow but it seems that there is a Lib mismatch. Light is not implemented so I replaces the dependency to jpct_ae.jar; Then other mismatches show up like constructor for FrameBuffer take anymore a sampling mode etc.

I will try tomorrow as that Bones-Android-Ninja project seems to have tones of demos in it.

Varanda

------------------------
Update on Bones-Android-Ninja attempt:

After following similar workflow that worked for BonesDemo, for Bones-Android-Ninja I get missing "import com.threed.jpct" in CollisionTestActivity.java

So I added compile files('../bones/lib/jpct-1.26.jar')

After adding jpct I get:

/Users/mvaranda/cglabs_svn/trunk/jpct-ae/examples/Bones-Android-Ninja1/bonesAndroidNinja/src/main/java/bones/samples/android/CollisionTestActivity.java
Error:(27, 23) error: cannot find symbol class Light
Error:(125, 7) error: cannot find symbol class Light
Error:(176, 34) error: incompatible types: GL10 cannot be converted to int
Error:(186, 22) error: cannot access Image
class file for java.awt.Image not found
Error:(249, 15) error: no suitable method found for display(no arguments)
method FrameBuffer.display(Graphics) is not applicable
(actual and formal argument lists differ in length)
method FrameBuffer.display(Graphics,int) is not applicable
(actual and formal argument lists differ in length)
method FrameBuffer.display(Graphics,int,int) is not applicable
(actual and formal argument lists differ in length)
...
...
...

Looks like a lib version mismatch.

Here is my Bones-Android-Ninja:
https://www.dropbox.com/s/m7jij2x8fnbgp3j/Bones-Android-Ninja.zip?dl=0





« Last Edit: March 12, 2016, 02:33:11 am by Varanda »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: samples under latest Android Studio
« Reply #7 on: March 12, 2016, 09:51:57 am »
...you have linked your project against the desktop version of jPCT, not the Android version. That explains the missing Light class, the different FrameBuffer constructor and such things. You don't want to do that...it won't work on Android.

Offline Varanda

  • byte
  • *
  • Posts: 27
    • View Profile
Re: samples under latest Android Studio
« Reply #8 on: March 13, 2016, 04:29:53 pm »
Not sure yet how AS pick the libs. Anyways, my 1440 faces animated model shows as 60fps. 5 instances still good as 41fps on a 3 year old Nexus 7.

https://youtu.be/sfV0Si7Mzww



BTW... is it worthy to trim the animation using curves or jPCT will interpolate keys disregarding Blender's curves?

« Last Edit: March 14, 2016, 12:19:22 am by Varanda »