question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

github_iconTop GitHub Comments

2reactions
simon-vogelcommented, Sep 1, 2021

Okay, now the header files are generated, thanks.

But if I run the app, the “cipher-lib.so” file not found :

java.lang.UnsatisfiedLinkError: dlopen failed: library "libcipher-lib.so" not found
        at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
        at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
        at java.lang.System.loadLibrary(System.java:1664)
        at net.idik.lib.cipher.so.CipherCore.<clinit>(CipherCore.java:9)
        at net.idik.lib.cipher.so.CipherCore.get(CipherCore.java:18)

the line where the error occurs is: System.loadLibrary("cipher-lib");

For all with the same Problem, the following part blocked that the libcipher-lib.so was packed into the .apk file:

tasks.whenTaskAdded { task ->
        // something specific
}

I replaced it with:

afterEvaluate {
    android.productFlavors.all {
        flavor ->
    }
}

So it is working now. Thank you for all your help so far @AdeelTariq!

@CaptainSilva I found a solution to execute ‘generateCipherSo’ automatically. Just add this inside the build.gradle for your individual flavors (if you have different keys for different flavors):

afterEvaluate {
    android.productFlavors.all {
        flavor ->
            tasks."extractDeepLinksFalvor1Debug".finalizedBy(generateFlavor1DebugCipherSoHeader)
            tasks."extractDeepLinksFalvor2Debug".finalizedBy(generateFlavor2DebugCipherSoHeader)
            ...
    }
}

So the ‘extern-keys.h’ will be procuced just before task ‘buildCMakeDebug’ , where it’s needed.

If you do not have different keys you can use the ‘configureCMakeDebug’ task:

afterEvaluate {
    android.productFlavors.all {
        flavor ->
            tasks."configureCMakeDebug".finalizedBy(generateSomeFlavorDebugCipherSoHeader)
            ...
    }
}

Hope it helps.

1reaction
AdeelTariqcommented, Jul 29, 2021

Jitpack builds are failing and this repository is not the only one effected. Maybe @linisme can fix the problem but they are not maintaining the repo anymore. So the workaround for now is to add a jar of the library to your project. Easiest is to find the cached jar file of the library on your system. Obviously if you never used the library before you won’t have a cached version. In that case you can build the jar file on your own.

To get the cached file, find the gradle cache directory on your system and go to ~/.gradle/caches/modules-2/files-2.1/com.github.MEiDIK or ~/.gradle/caches/modules-2/files-2.1/com.github.linisme

In there you’ll find the cached jar. Copy it to your project. Mine is inside the app/libs folder.

Next add this one line to your top level gradle file:

buildscript {
    repositories {
        …
        flatDir dirs: "app/libs"    // <-- Relative path to where the jar file is
    }
    dependencies {
        …
    }
}

Your project should compile now. Also the gradle directory may be in a different location. Or your project may be structured differently. So adjust accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to include *.so library in Android Studio? - Stack Overflow
Please try first the jniLibs folder solution. This tasks should be put into your app/library gradle.build file. – nenick. Sep 16, 2016 at...
Read more >
Visual Studio Code and Unity
Unity Development with VS Code. Visual Studio Code can be a great companion to Unity for editing C# files. All of the C#...
Read more >
Improve your code with lint checks - Android Developers
The lint tool checks your Android project source files for potential bugs and optimization improvements for correctness, security, performance, usability, ...
Read more >
Develop Azure Functions by using Visual Studio Code
Core Tools includes the entire Azure Functions runtime, so download and ... You can always add a function to your project later.
Read more >
Code Owners - GitLab Docs
You can set your merge requests so they must be approved by Code Owners before ... If you do not invite Subgroup Y...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found