dex2c icon indicating copy to clipboard operation
dex2c copied to clipboard

Windows: Error building with NDK

Open SharkPika opened this issue 7 months ago • 16 comments

This is the complete output: D:\dex2c>python dcc.py -a SkyCloudDriven.apk -o out.apk -p --filter filter.txt [INFO ] dcc: Creating .tmp folder [INFO ] dcc: Backing up jni folder [INFO ] dcc: Adjusting Application.mk file using available abis from apk [INFO ] dcc: No lib abis found in apk, using the ones defined in Application.mk file [WARNING ] androguard.core.api_specific_resources: Requested API level 35 is larger than maximum we have, returning API level 34 instead. make: *** No rule to make target 'jni/nc/Java_cn_sky_app_adapter_FileListAdapter_00024_00024ExternalSyntheticLambda0__0003cinit_0003e__Lcn_sky_app_adapter_FileListAdapter_2Lcn_sky_app_adapter_FileListAdapter_00024ViewHolder_2Ljava_lang_String_2.cpp', needed by 'obj/local/armeabi-v7a/objs/stub/nc/Java_cn_sky_app_adapter_FileListAdapter_00024_00024ExternalSyntheticLambda0__0003cinit_0003e__Lcn_sky_app_adapter_FileListAdapter_2Lcn_sky_app_adapter_FileListAdapter_00024ViewHolder_2Ljava_lang_String_2.o'. Stop. make: *** Waiting for unfinished jobs.... [ERROR ] dcc: Compile SkyCloudDriven.apk failed! Traceback (most recent call last): File "D:\QQ\1127367472\FileRecv\Source\dex2c\dcc.py", line 1189, in dcc_main( File "D:\QQ\1127367472\FileRecv\Source\dex2c\dcc.py", line 922, in dcc_main build_project(project_dir) File "D:\QQ\1127367472\FileRecv\Source\dex2c\dcc.py", line 311, in build_project check_call([NDKBUILD, "-j%d" % cpu_count(), "-C", project_dir], stderr=STDOUT) File "C:\Program Files\Python312\Lib\subprocess.py", line 413, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['E:\BaiduNetdiskDownload\Android\Ndk\ndk-build.cmd', '-j12', '-C', '.tmp\dcc-project-NLuDE6Pw']' returned non-zero exit status 2. Command '['E:\BaiduNetdiskDownload\Android\Ndk\ndk-build.cmd', '-j12', '-C', '.tmp\dcc-project-NLuDE6Pw']' returned non-zero exit status 2. [INFO ] dcc: Restoring jni folder [INFO ] dcc: Removing .tmp folder

Help plz!

SharkPika avatar May 24 '25 18:05 SharkPika

Hi @SharkPika,

Just some questions:

  • Your initial command shows the project location at D:\dex2c and then after few lines it shows at D:\QQ\1127367472\FileRecv\Source\dex2c?
  • What Android NDK Version you're using, have you confirmed the correct location of the ndk path and ndk-build file under it ?
  • Are you on latest commit of the repo or not?

Thanks, Abhi

AbhiTheModder avatar May 24 '25 18:05 AbhiTheModder

Furthermore, you might also want to consider looking at this issue related to windows as well: https://github.com/codehasan/dex2c/issues/33#issuecomment-2507617194

AbhiTheModder avatar May 24 '25 18:05 AbhiTheModder

The paths are all correct, but I manually deleted QQ\1127367472\FileRecv\Source\

SharkPika avatar May 24 '25 18:05 SharkPika

The NDK version used is the latest stable version, r28b

SharkPika avatar May 24 '25 18:05 SharkPika

and I used dex2c after "git clone"

SharkPika avatar May 24 '25 18:05 SharkPika

I can run the command manually using CMD, but it seems to suddenly stop halfway through without any errors just like: E:\BaiduNetdiskDownload\Android\Ndk>ndk-build.cmd -j12 -C D:\QQ\1127367472\FileRecv\Source\dex2c\compile\jni make: Entering directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' [armeabi-v7a] Compile++ thumb: stub <= Java_cn_sky_app_BuildConfig__0003cinit_0003e__.cpp make: Leaving directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' make: Entering directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' [armeabi-v7a] Compile++ thumb: stub <= Java_cn_sky_app_LoginActivity_000241__0003cinit_0003e__Lcn_sky_app_LoginActivity_2Ljava_lang_String_2Ljava_lang_String_2.cpp make: Leaving directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' make: Entering directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' [armeabi-v7a] Compile++ thumb: stub <= Java_cn_sky_app_LoginActivity_000241_onFailure__Lretrofit2_Call_2Ljava_lang_Throwable_2.cpp ····· make: Entering directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' [armeabi-v7a] Compile++ thumb: stub <= Java_cn_sky_app_Tool_getImages__Landroid_content_Context_2.cpp make: Leaving directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' make: Entering directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' [armeabi-v7a] Compile++ thumb: stub <= Java_cn_sky_app_Tool_getVideos__Landroid_content_Context_2.cpp make: Leaving directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' make: Entering directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni' [armeabi-v7a] Compile++ thumb: stub <= Java_cn_sky_app_adapter_FileListAdapter_00024ViewHolder__0003cinit_0003e__Landroid_view_View_2.cpp make: Leaving directory 'D:/QQ/1127367472/FileRecv/Source/dex2c/compile/jni'

E:\BaiduNetdiskDownload\Android\Ndk>

and done it created "obj" folder under output folder, but the number of files inside is much fewer than the compiled cpp files

SharkPika avatar May 24 '25 18:05 SharkPika

I can run the command manually using CMD

You shouldn't do that

AbhiTheModder avatar May 24 '25 18:05 AbhiTheModder

I can run the command manually using CMD

You shouldn't do that

I only did this for testing purposes

SharkPika avatar May 24 '25 18:05 SharkPika

Please attempt to compile it again with the correct configurations, test it on other sample apps, and verify whether the issue persists exclusively with this specific application. If feasible, provide the sample you are working on to help reproduce the problem.

AbhiTheModder avatar May 24 '25 18:05 AbhiTheModder

I am unable to upload the file, so I will only provide a verbal description start cmd: python dcc.py -a SkyCloudDriven.apk -o out.apk -p --filter filter.txt filter: cn/sky/app/.;. Application.mk change: APP_PLATFORM := android-19 -> APP_PLATFORM := android-21 NDK path: "E:\BaiduNetdiskDownload\Android\Ndk" dex2c path: "D:\QQ\1127367472\FileRecv\Source\dex2c" cfg: { "apktool": "tools/apktool.jar", "ndk_dir": "E:\\BaiduNetdiskDownload\\Android\\Ndk", "signature": { "keystore_path": "keystore/skyclouddriven.keystore", "alias": "skycloud", "keystore_pass": "skycloud", "store_pass": "skycloud", "v1_enabled": true, "v2_enabled": true, "v3_enabled": true } }

SharkPika avatar May 24 '25 19:05 SharkPika

filter: cn/sky/app/.;.

Your filter seems invalid. check out https://github.com/codehasan/dex2c#filters for guidance on creating valid filters.

"ndk_dir": "E:\BaiduNetdiskDownload\Android\Ndk",

Kindly avoid using \ in paths and replace them with / instead. This is why I suggested referring to https://github.com/codehasan/dex2c/issues/33#issuecomment-2507617194 a few messages earlier.

AbhiTheModder avatar May 24 '25 19:05 AbhiTheModder

filter: cn/sky/app/.;.

Your filter seems invalid. check out https://github.com/codehasan/dex2c#filters for guidance on creating valid filters.

"ndk_dir": "E:\BaiduNetdiskDownload\Android\Ndk",

Kindly avoid using \ in paths and replace them with / instead. This is why I suggested referring to #33 (comment) a few messages earlier.

Github replace "*" to none

and I replace "\" to "/" still the same result

SharkPika avatar May 24 '25 19:05 SharkPika

Github replace "*" to none

makes sense, got it.

and I replace "" to "/" still the same result

Without any way to reproduce your issue, we can't help you.

AbhiTheModder avatar May 24 '25 19:05 AbhiTheModder

SkyCloudDriven.zip this is my apk file, try obf it with Dex2c plz

SharkPika avatar May 25 '25 07:05 SharkPika

SkyCloudDriven.zip this is my apk file, try obf it with Dex2c plz

Thanks for the sample, I'll get back to you in a while.

AbhiTheModder avatar May 25 '25 10:05 AbhiTheModder

SkyCloudDriven.zip this is my apk file, try obf it with Dex2c plz

Hi, I'm able to reproduce the issue on windows, for now the solution is to either use WSL (in windows) or a Linux machine, until I (or someone else) can figure out the root cause and push a fix.

Thanks, Abhi

AbhiTheModder avatar May 25 '25 17:05 AbhiTheModder