OpenSSL problem again

  1. I was using 3.0.4 and visual studio 2012
  2. cocos compile -p android
  3. Something like that cannot find module

I’ve tried clean and rebuild.

Got it. Please paste the error message here if it exists.

I just tried using the Cocos Studio to build, here’s the error log

Based on: cocos2d-x-3.10
Updated project.properties
Updated local.properties
Updated file D:\workspace\cocos\TestGame\proj.android\proguard-project.txt
Android NDK: WARNING: APP_PLATFORM android-15 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml    
make.exe: Entering directory `D:/workspace/cocos/TestGame/proj.android'
[armeabi] Compile++ thumb: cocos2dcpp_shared <= AppDelegate.cpp
[armeabi] Compile++ thumb: cocos2dcpp_shared <= HelloWorldScene.cpp
[armeabi] Compile++ thumb: cocos2dcpp_shared <= main.cpp
[armeabi] Compile thumb  : cpufeatures <= cpu-features.c
[armeabi] StaticLibrary  : libcpufeatures.a
[armeabi] SharedLibrary  : libcocos2dcpp.so
[armeabi] Install        : libcocos2dcpp.so => libs/armeabi/libcocos2dcpp.so
make.exe: Leaving directory `D:/workspace/cocos/TestGame/proj.android'
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.0_45\lib\tools.jar
Buildfile: D:\workspace\cocos\TestGame\proj.android\build.xml
-check-env:
 [checkenv] Android SDK Tools Revision 25.1.2
 [checkenv] Installed at C:\program\dev\android-sdk
-setup:
     [echo] Project Name: TestGame
  [gettype] Project Type: Application
-pre-clean:
clean:
[getlibpath] Library dependencies:
[getlibpath] No Libraries
   [subant] No sub-builds to iterate on
-set-mode-check:
-set-debug-files:
-check-env:
 [checkenv] Android SDK Tools Revision 25.1.2
 [checkenv] Installed at C:\program\dev\android-sdk
-setup:
     [echo] Project Name: TestGame
  [gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 23.0.3
     [echo] Resolving Build Target for TestGame...
[gettarget] Project Target:   Android 4.0.3
[gettarget] API level:        15
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: D:\workspace\cocos\TestGame\proj.android\bin
    [mkdir] Created dir: D:\workspace\cocos\TestGame\proj.android\bin\res
    [mkdir] Created dir: D:\workspace\cocos\TestGame\proj.android\bin\rsObj
    [mkdir] Created dir: D:\workspace\cocos\TestGame\proj.android\bin\rsLibs
    [mkdir] Created dir: D:\workspace\cocos\TestGame\proj.android\gen
    [mkdir] Created dir: D:\workspace\cocos\TestGame\proj.android\bin\classes
    [mkdir] Created dir: D:\workspace\cocos\TestGame\proj.android\bin\dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for TestGame...
[dependency] Ordered libraries:
[dependency] 
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] Found 1 AIDL files.
     [aidl] Compiling 1 AIDL files.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
BUILD FAILED
C:\program\dev\android-sdk\tools\ant\build.xml:716: The following error occurred while executing this line:
C:\program\dev\android-sdk\tools\ant\build.xml:730: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre1.8.0_45"
Total time: 3 seconds
Building mode: debug
Using Eclipse project : D:\workspace\cocos\TestGame\proj.android
Android platform not specified, searching a default one...
running: '"C:\program\dev\android-sdk\tools\android" update project -t android-15 -p D:\workspace\cocos\TestGame\proj.android'
Building native...
NDK build mode: release
NDK_TOOLCHAIN_VERSION: 4.9
running: '"C:\program\dev\android-ndk-r10d\ndk-build" -C D:\workspace\cocos\TestGame\proj.android -j3 NDK_MODULE_PATH=C:\Cocos\cocos2d-x/cocos2d-x-3.10;C:\Cocos\cocos2d-x/cocos2d-x-3.10/cocos;C:\Cocos\cocos2d-x/cocos2d-x-3.10/external NDK_TOOLCHAIN_VERSION=4.9'
Building apk...
running: '"C:\Cocos\tools\ant\bin\ant" clean debug -f D:\workspace\cocos\TestGame\proj.android\build.xml -Dsdk.dir="C:\program\dev\android-sdk"'
Error running command, return code: 1.

[armeabi] StaticLibrary : libcpufeatures.a
[armeabi] SharedLibrary : libcocos2dcpp.so
[armeabi] Install : libcocos2dcpp.so => libs/armeabi/libcocos2dcpp.so

It seems native codes have been built correctly.

BUILD FAILED
C:\program\dev\android-sdk\tools\ant\build.xml:716: The following error occurred while executing this line:
C:\program\dev\android-sdk\tools\ant\build.xml:730: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to “C:\Program Files\Java\jre1.8.0_45”

The log said you haven’t set JAVA_HOME environment.

So the error happened in generating APK file. Have you ever succeeded building for Android? It said you lost JAVA_HOME environment when compiling java source code.

The build is working now using build_native.py, I don’t know why the compile is not working…

The new cocos does not have CCScale9Sprite anymore? I got this error

In file included from jni/hellocpp/main.cpp:1:0:
jni/../../Classes/AppDelegate.h:6:65: fatal error: ../extensions/GUI/CCControlExtension/CCScale9Sprite.h: No such file or directory
 #include "../extensions/GUI/CCControlExtension/CCScale9Sprite.h"

I think I need to change the sprite codes for the new cocos, so now the main question is how to remove the libcurl?

About CCScale9Sprite.h, i don’t know if you means UIScale9Sprite.h.

As your Android.mk shown above, it depend extensions, and extensions includes assets-manager which depends on libcurl. So i think you should don’t depend on extensions or remove assets-manager in extensions/Android.mk.

CCScale9Sprite is this http://cocos2d-x.org/reference/native-cpp/V3.0/db/d24/_c_c_scale9_sprite_8h.html
It depends on the cocos2d::extension so I cannot remove the extensions.

So if I migrate the project to new cocos using UIScale9Sprite and don’t include extensions in the mk file, I can remove the libcurl from the apk?

I understand now. Thank you very much for your posts :slight_smile:

You can remove the libcurl even without upgrading cocos2d-x. You can remove assets-manager related codes out of extensions/Android.mk.

Hello

I use cocos2d-x v2.2.6. I want to update to the new libcurl, but I also need the header files for ssl and crypo libraries, because my code is using some method that are not exposeb by the libcurl headers.
Can you please also put these headers there?

I think you can copy these files from their official sites.

add 2 lines in my projects’ Android.mk. It works, ndk version is android-ndk-r8b, no need to upgrade

LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

LOCAL_WHOLE_STATIC_LIBRARIES += cocos_ssl_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_crypto_static

Can we have these files added to the cocos2d-x 2.2.6 project?

Thanks!

Yep, i think it is not problem. You can add these header files into your project.

My app is using 3.8.1. It is not released yet but I saw this issue today so I tried to apply patch’s from @Obg1
I ran unzip -p YourApp.apk | strings | grep “OpenSSL” but nothing came up.
I tried other APKs which was built earlier but it’s same, unzip command just finish without any message after few seconds.
What did I do wrong?

If you can not find OpenSSL then i think your app is not using it which means you don’t have to care about this issue.

I use cocos2dx v3.6 and updated curl and openssl libraries
when i try on android to download file from HTTPS url via class frameworks\js-bindings\cocos2d-x\extensions\assets-manager\Downloader i recieved curl error “Peer certificate cannot be authenticated with given CA certificates”
in your class frameworks\js-bindings\cocos2d-x\extensions\assets-manager\AssetsManager there is additional parameter in curl setup

curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, 0L);

but it is not safe
How to rebuild curl and openssl libraries for using HTTPS protocol on android platform?

@IuriiBaranskyi I think it is nothing about curl version. It is the usage of curl caused the issue. Please create another ticket.

new ticket was created HTTPS using problem on Android via curl library
@zhangxm, thank you

Thanx I just fixed my cocos2dx 2.2.6. thanx guys. Appreciated

Hello
Can you please describe how you fixed the problem?