Cocos2d-x v3.12 released!

Hi guys
I tried to compile the “HelloWorld” project with:

cocos run -s . -p android --ap android-23 -m release

And I get this errors:

-compile:
        [javac] Compiling 28 source files to /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/bin/classes
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:9: error: package org.apache.http does not exist
        [javac] import org.apache.http.Header;
        [javac]                       ^
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:10: error: package org.apache.http.message does not exist
        [javac] import org.apache.http.message.BasicHeader;
        [javac]                               ^
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:47: error: cannot find symbol
        [javac]     public void onFailure(int i, Header[] headers, byte[] errorResponse, Throwable throwable) {
        [javac]                                  ^
        [javac]   symbol:   class Header
        [javac]   location: class DataTaskHandler
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:57: error: cannot find symbol
        [javac]     public void onSuccess(int i, Header[] headers, byte[] binaryData) {
        [javac]                                  ^
        [javac]   symbol:   class Header
        [javac]   location: class DataTaskHandler
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:106: error: cannot find symbol
        [javac]     public void onFailure(int i, Header[] headers, Throwable throwable, File file) {
        [javac]                                  ^
        [javac]   symbol:   class Header
        [javac]   location: class FileTaskHandler
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:116: error: cannot find symbol
        [javac]     public void onSuccess(int i, Header[] headers, File file) {
        [javac]                                  ^
        [javac]   symbol:   class Header
        [javac]   location: class FileTaskHandler
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:253: error: cannot find symbol
        [javac]                     Header[] headers = null;
        [javac]                     ^
        [javac]   symbol: class Header
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:257: error: cannot find symbol
        [javac]                         List<Header> list = new ArrayList<Header>();
        [javac]                              ^
        [javac]   symbol: class Header
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:257: error: cannot find symbol
        [javac]                         List<Header> list = new ArrayList<Header>();
        [javac]                                                           ^
        [javac]   symbol: class Header
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:258: error: cannot find symbol
        [javac]                         list.add(new BasicHeader("Range", "bytes=" + fileLen + "-"));
        [javac]                                      ^
        [javac]   symbol: class BasicHeader
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:259: error: cannot find symbol
        [javac]                         headers = list.toArray(new Header[list.size()]);
        [javac]                                                    ^
        [javac]   symbol: class Header
        [javac] /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java:261: error: cannot access HttpEntity
        [javac]                     task.handle = downloader._httpClient.get(Cocos2dxHelper.getActivity(), url, headers, null, task.handler);
        [javac]                                                         ^
        [javac]   class file for org.apache.http.HttpEntity not found
        [javac] Note: Some input files use or override a deprecated API.
        [javac] Note: Recompile with -Xlint:deprecation for details.
        [javac] Note: /home/drk/cocos2d-projects/TEST/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java uses unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
        [javac] 12 errors

I did a successful build with

cocos run -s . -p android --ap android-18

I’m using NDK 11c

Hi, in near future, will JS support Tizen platform??
thanks smile

You need to add

useLibrary  'org.apache.http.legacy'

under “android” node in the build.gradle of the lib project if the targetSDK in gradle script is 23 or above.

@na299 what build.gradle should I modify?
I modified cocos2d/cocos/platform/android/libcocos2dx/build.gradle

And now looks like this:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

    sourceSets.main {
        aidl.srcDir "../java/src"
        java.srcDir "../java/src"
        manifest.srcFile "AndroidManifest.xml"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: '../java/libs', include: ['*.jar'])
}

However I have the problem yet!

yeah, that is the file I was talking about.
But now I don’t know why you are still getting the error… Sorry…

–UPDATE–
Ah, I see, you are using Eclipse project! not android studio…
If you have Android studio, try with parameter: --android-studio in your build command:

cocos run -s . -p android --ap android-23 -m release --android-studio

I don’t know how to include the legacy library in ADT project with Eclipse.

@na299

Yep, by now I’m using the proj.android project.
I’m not using Android Studio! It is required to use --android-studio or it is sufficient to install gradle?
Should I report this problem on https://github.com/cocos2d/cocos2d-x/issues?

For now I’m using the solution proposed in this topic:

I can now build with:

cocos run -s . -p android --ap android-23 -m release
1 Like

I think that is the solution for ADT project…

I’m facing this error on xcode v6.1.1:
/cocos2d/cocos/platform/ios/CCDevice-ios.mm Line 348:

Cannot initialize a parameter of type 'NSStringDrawingOptions' with an rvalue of type 'long'

dim = [str boundingRectWithSize:CGSizeMake(textRect.width, textRect.height)
  options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
  context:nil].size;

@CrazyHappyGame Indeed Android break compatibility usually, we can not make sure which version has the problem, for example, please refer to this issue.

Why remove “getOrderOfArrival”

If removed this function, should using stable_sort in Node::sortAllChildren!!?

like Sort Issue

I get this error when i build for ios

“_CTFramesetterCreateWithAttributedString”, referenced from:

  _calculateShrinkedSizeForString(NSAttributedString**, objc_object*, CGSize, bool, int&) in libcocos2d iOS.a(CCDevice-ios.o)

“_CTFramesetterSuggestFrameSizeWithConstraints”, referenced from:

  _calculateShrinkedSizeForString(NSAttributedString**, objc_object*, CGSize, bool, int&) in libcocos2d iOS.a(CCDevice-ios.o)

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

I upgraded cocos by replacing the cocos2d folder… this gave the above error.

I fixed it by creating a new project and and then replacing classes and resources folder. It worked fine.

Thanks

Once again: I think that all users should be forced to use one sdk/ndk version. Can we encode this in cocos console?

Just updated cocos from 3.10 to 3.12 (generated new precompiled libs and replaced paths) and ndk from r10d to r11c. App works well on iOS, but on Android is totally broken. Textures are randomly appearing and disappearing… In some screens I can see only part of textures.

I can see a lot of these in logcat:
D/cocos2d-x debug info(31306): textureSize = 0

I made sure to clean obj directory.

Tested on 2 devices with android 6.0 and 5.1.

Thanks for the info - I was getting the same error - at least now I know what to do to fix it - even if I don’t understand why!!

After some research and experimentation I’ve came to conclusion there’s something wrong with loading sprites (or other ui) from cocos studio .csb file. I think it only loads several of them and then stops loading them. I had like 30+ sprites and could only see about 16… But when I changed order in editor I started to see new ones while lost some other.

@b12345 @Maxxx or you can add Core Text to your project :slight_smile:

1 Like

@CrazyHappyGame i don’t think we can encode it in cocos console, i think we should fix it in cocos2d-x.
@piotrros cocos studio is canceled, and it is not updated since v3.11.

@zhangxm Thanks for the answer. Indeed I got it working on 3.11 so at least I can avoid ipv6 problems, however android performance issue fix from 3.12 seems pretty important and I can’t use it… Cocos studio is cancelled, 3.12 isn’t compatible anymore and yet there’s no alternative, because cocos creator doesn’t support c++ yet. Seems pretty bad practice to me…