WoooHaaaa
WoooHaaaa

Reputation: 20470

Latest NDK can't find module libz

I was using NDK 13.1 before, but after I updated it to 16.1(seems the latest one), my Android project can't libz any more.

```

Error:(693) Android NDK: Module pngt depends on undefined modules: z

Error:(706) *** Android NDK: Aborting (set APP_ALLOW_MISSING_DEPS=true to >allow missing dependencies) . Stop.

Error:A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugApk'. A problem occurred configuring project ':xxx'. executing external native build for ndkBuild xxx/jni/Android.mk ```

I did't change anything else at all, and also I can find libz stay in my android NDK directory correctly.

Any suggestion?

Upvotes: 1

Views: 1468

Answers (3)

Gandalf
Gandalf

Reputation: 3257

I had exact same problem, I don't know if this could help your case but since This question was the first question that came up in my searches to solve this problem, I have decided to answer it for other people that have done it wrong, the way I did:

I did this which gave me the error: find_library(zlib libz) # wrong way which was wrong and I had to omit the lib part of libz like this:

find_library(zlib z) # right way

Upvotes: 1

Dan Albert
Dan Albert

Reputation: 10509

If you're getting that error, just remove libz from your LOCAL_SHARED_LIRBARIES. It wasn't being used before. That warnings is to tell you that it was being ignored.

Upvotes: 1

Surge1223
Surge1223

Reputation: 101

Try adding this to your Android.mk :

LOCAL_LDLIBS := -lz

If that doesn't work, use LDFLAGS to specify the path to the libz.so

For me for ex.

LOCAL_LDFLAGS := -L/opt/sdk/ndk-bundle/platforms/android-24/arch-arm64/usr/lib

Of course this is assuming that you originally had the below, which is failing now.

LOCAL_SHARED_LIBRARIES := libz

Upvotes: 0

Related Questions