How to use android-19 and resolve "rand" problem?

Continuing the discussion from Cannot locate symbol “rand” - ndk-r10d android-21:

I’m confused here, and having trouble just getting started. I’m trying to set up three projects and the cpp-tests in eclipse with ADT. I know I had cpp-tests working before, when I was using cocos2d-x version 3.4, but something’s broken. I’ve updated to the 35-tizen 2dx, fyi.

I’ve been developing in cocos2d and objective c for four years, but I’m trying to move to 2dx so I can port my apps to Android. I’m having two problems that I just can’t seem to resolve.

First problem, cpp-tests no longer launches, getting this same error about “rand”. When I run “android list targets” I see
id: 1 or “android-21”

id: 2 or “Google Inc.: Google APIs: 21”

How do I change my application to use android-19?

Second problem, unrelated, is when I try to create multiple targets in Eclipse (so far, I’m running everything from the command line). I import project one and then I have to import the cocos2d code as well, so I import the project from /cocos2d/cocos/platforms/android/bin.

But then when I try to import my second project, I can’t import that project’s cocos2d project because it has the same name as the cocos2d project I imported for project 1. And if I try to point to the existing cocos2d project, the program fails to run. How do I set up an external instance of cocos2d jar or project and have multiple projects work with it?

thanks

Ok, I have this working now (not the Eclipse problem, but the version 19). I used SDK Manager to pull down SDK 19.

Oh, crap, when I moved back up to 2dx 3.5, even though I built with “19” it’s still trying to run as “21” - I see Android-21 in the project.properties file, but that file is generated. How the heck do I tell the project to build and run on Android-19?? I’ve run “cocos run --help” and don’t see a way to specify the sdk. [Actually, an easy solution for now - I’ll go back to using 2dx version 3.4] FYI, found out how to specify on the run command, from here (http://stackoverflow.com/questions/23551144/cocos2d-x-doesnt-find-android-platform). Turns out that “-ap 19” doesn’t work, but “-ap android-19” does.

Just a quick question, while I’m changing SDK versions. I see that a lot of users still have Android 4.1 and 4.2 (sdk 16 and 17). What are the thoughts of going back to sdk 16 or 17?

BTW, if anyone has any advice on the Eclipse problem, I’d appreciate that.

thanks!

Make sure you change it in the project properties:
target=android-19

EDIT: And to be complete, here is my line in the android manifest.xml:

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19"/>
1 Like