Android: use so files from other project





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I try to use external sdk which include jar file and some *.so files. Also have sample project from eclipse which include same files in it. When I import project into android studio it works fine but when I tried to copy *.so files from imported project to my current project it cause error UnsatisfiedLinkError



Sample project target api 14, mine project target api 27. Should I inlude ndk support to my current project and recompile this *.so files or maybe is any option to use old files from sample?










share|improve this question

























  • You try to call a native method from your kotlin code, and expect that the implementation in the external so file will be called? It won't, because the names are different

    – Alex Cohn
    Nov 24 '18 at 7:38











  • @AlexCohn nope. I don't use directly methods from native code but library which I used need this files to works fine

    – mircze
    Nov 24 '18 at 17:24


















0















I try to use external sdk which include jar file and some *.so files. Also have sample project from eclipse which include same files in it. When I import project into android studio it works fine but when I tried to copy *.so files from imported project to my current project it cause error UnsatisfiedLinkError



Sample project target api 14, mine project target api 27. Should I inlude ndk support to my current project and recompile this *.so files or maybe is any option to use old files from sample?










share|improve this question

























  • You try to call a native method from your kotlin code, and expect that the implementation in the external so file will be called? It won't, because the names are different

    – Alex Cohn
    Nov 24 '18 at 7:38











  • @AlexCohn nope. I don't use directly methods from native code but library which I used need this files to works fine

    – mircze
    Nov 24 '18 at 17:24














0












0








0








I try to use external sdk which include jar file and some *.so files. Also have sample project from eclipse which include same files in it. When I import project into android studio it works fine but when I tried to copy *.so files from imported project to my current project it cause error UnsatisfiedLinkError



Sample project target api 14, mine project target api 27. Should I inlude ndk support to my current project and recompile this *.so files or maybe is any option to use old files from sample?










share|improve this question
















I try to use external sdk which include jar file and some *.so files. Also have sample project from eclipse which include same files in it. When I import project into android studio it works fine but when I tried to copy *.so files from imported project to my current project it cause error UnsatisfiedLinkError



Sample project target api 14, mine project target api 27. Should I inlude ndk support to my current project and recompile this *.so files or maybe is any option to use old files from sample?







android android-ndk shared-libraries






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 14:36









Jayson Minard

42.7k20117177




42.7k20117177










asked Nov 23 '18 at 20:42









mirczemircze

31




31













  • You try to call a native method from your kotlin code, and expect that the implementation in the external so file will be called? It won't, because the names are different

    – Alex Cohn
    Nov 24 '18 at 7:38











  • @AlexCohn nope. I don't use directly methods from native code but library which I used need this files to works fine

    – mircze
    Nov 24 '18 at 17:24



















  • You try to call a native method from your kotlin code, and expect that the implementation in the external so file will be called? It won't, because the names are different

    – Alex Cohn
    Nov 24 '18 at 7:38











  • @AlexCohn nope. I don't use directly methods from native code but library which I used need this files to works fine

    – mircze
    Nov 24 '18 at 17:24

















You try to call a native method from your kotlin code, and expect that the implementation in the external so file will be called? It won't, because the names are different

– Alex Cohn
Nov 24 '18 at 7:38





You try to call a native method from your kotlin code, and expect that the implementation in the external so file will be called? It won't, because the names are different

– Alex Cohn
Nov 24 '18 at 7:38













@AlexCohn nope. I don't use directly methods from native code but library which I used need this files to works fine

– mircze
Nov 24 '18 at 17:24





@AlexCohn nope. I don't use directly methods from native code but library which I used need this files to works fine

– mircze
Nov 24 '18 at 17:24












1 Answer
1






active

oldest

votes


















1














1.create a folder named jniLibs under main folder, the structure is like below fig.



 |–app:
|–|–src:
|–|–|–main
|–|–|–|–jniLibs
|–|–|–|–|–armeabi
|–|–|–|–|–|–.so Files
|–|–|–|–|–x86
|–|–|–|–|–|–.so Files
...
|–|–|–|–|–other abi folder such as armeabi-v7a
|–|–|–|–|–|–.so Files




  1. place .jar file in project libs folder and add below line in module build.gradle file



    dependencies {
    implementation files('libs/your_own.jar')
    }




All should be ok.



Edited:
some of android devices(emulator) has 64-bit processors, if your jinLibs hasn't arm64 subfolder, you could add this filters(abiFilters) to your app module’s build.gradle files:



defaultConfig {
...

ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}

}


this will tell app only use .so files in existing folders.






share|improve this answer


























  • That's the way how I try to figure out before but not working. Structure which you post here is like in sample project after import to android studio from eclipse project. After create same in my current project I have error which I mentioned above :(

    – mircze
    Nov 23 '18 at 22:14













  • @mircze plz see my edited, which is an example.

    – navylover
    Nov 23 '18 at 22:22






  • 1





    thanks, that fixed my problem, so files from sample has only armeabi version but works fine on my phone. But in my current project I need to specify ndk configuration which you post here to works in same device, strange for me :/

    – mircze
    Nov 24 '18 at 17:28












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452735%2fandroid-use-so-files-from-other-project%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














1.create a folder named jniLibs under main folder, the structure is like below fig.



 |–app:
|–|–src:
|–|–|–main
|–|–|–|–jniLibs
|–|–|–|–|–armeabi
|–|–|–|–|–|–.so Files
|–|–|–|–|–x86
|–|–|–|–|–|–.so Files
...
|–|–|–|–|–other abi folder such as armeabi-v7a
|–|–|–|–|–|–.so Files




  1. place .jar file in project libs folder and add below line in module build.gradle file



    dependencies {
    implementation files('libs/your_own.jar')
    }




All should be ok.



Edited:
some of android devices(emulator) has 64-bit processors, if your jinLibs hasn't arm64 subfolder, you could add this filters(abiFilters) to your app module’s build.gradle files:



defaultConfig {
...

ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}

}


this will tell app only use .so files in existing folders.






share|improve this answer


























  • That's the way how I try to figure out before but not working. Structure which you post here is like in sample project after import to android studio from eclipse project. After create same in my current project I have error which I mentioned above :(

    – mircze
    Nov 23 '18 at 22:14













  • @mircze plz see my edited, which is an example.

    – navylover
    Nov 23 '18 at 22:22






  • 1





    thanks, that fixed my problem, so files from sample has only armeabi version but works fine on my phone. But in my current project I need to specify ndk configuration which you post here to works in same device, strange for me :/

    – mircze
    Nov 24 '18 at 17:28
















1














1.create a folder named jniLibs under main folder, the structure is like below fig.



 |–app:
|–|–src:
|–|–|–main
|–|–|–|–jniLibs
|–|–|–|–|–armeabi
|–|–|–|–|–|–.so Files
|–|–|–|–|–x86
|–|–|–|–|–|–.so Files
...
|–|–|–|–|–other abi folder such as armeabi-v7a
|–|–|–|–|–|–.so Files




  1. place .jar file in project libs folder and add below line in module build.gradle file



    dependencies {
    implementation files('libs/your_own.jar')
    }




All should be ok.



Edited:
some of android devices(emulator) has 64-bit processors, if your jinLibs hasn't arm64 subfolder, you could add this filters(abiFilters) to your app module’s build.gradle files:



defaultConfig {
...

ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}

}


this will tell app only use .so files in existing folders.






share|improve this answer


























  • That's the way how I try to figure out before but not working. Structure which you post here is like in sample project after import to android studio from eclipse project. After create same in my current project I have error which I mentioned above :(

    – mircze
    Nov 23 '18 at 22:14













  • @mircze plz see my edited, which is an example.

    – navylover
    Nov 23 '18 at 22:22






  • 1





    thanks, that fixed my problem, so files from sample has only armeabi version but works fine on my phone. But in my current project I need to specify ndk configuration which you post here to works in same device, strange for me :/

    – mircze
    Nov 24 '18 at 17:28














1












1








1







1.create a folder named jniLibs under main folder, the structure is like below fig.



 |–app:
|–|–src:
|–|–|–main
|–|–|–|–jniLibs
|–|–|–|–|–armeabi
|–|–|–|–|–|–.so Files
|–|–|–|–|–x86
|–|–|–|–|–|–.so Files
...
|–|–|–|–|–other abi folder such as armeabi-v7a
|–|–|–|–|–|–.so Files




  1. place .jar file in project libs folder and add below line in module build.gradle file



    dependencies {
    implementation files('libs/your_own.jar')
    }




All should be ok.



Edited:
some of android devices(emulator) has 64-bit processors, if your jinLibs hasn't arm64 subfolder, you could add this filters(abiFilters) to your app module’s build.gradle files:



defaultConfig {
...

ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}

}


this will tell app only use .so files in existing folders.






share|improve this answer















1.create a folder named jniLibs under main folder, the structure is like below fig.



 |–app:
|–|–src:
|–|–|–main
|–|–|–|–jniLibs
|–|–|–|–|–armeabi
|–|–|–|–|–|–.so Files
|–|–|–|–|–x86
|–|–|–|–|–|–.so Files
...
|–|–|–|–|–other abi folder such as armeabi-v7a
|–|–|–|–|–|–.so Files




  1. place .jar file in project libs folder and add below line in module build.gradle file



    dependencies {
    implementation files('libs/your_own.jar')
    }




All should be ok.



Edited:
some of android devices(emulator) has 64-bit processors, if your jinLibs hasn't arm64 subfolder, you could add this filters(abiFilters) to your app module’s build.gradle files:



defaultConfig {
...

ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}

}


this will tell app only use .so files in existing folders.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 '18 at 22:24

























answered Nov 23 '18 at 22:03









navylovernavylover

3,67531221




3,67531221













  • That's the way how I try to figure out before but not working. Structure which you post here is like in sample project after import to android studio from eclipse project. After create same in my current project I have error which I mentioned above :(

    – mircze
    Nov 23 '18 at 22:14













  • @mircze plz see my edited, which is an example.

    – navylover
    Nov 23 '18 at 22:22






  • 1





    thanks, that fixed my problem, so files from sample has only armeabi version but works fine on my phone. But in my current project I need to specify ndk configuration which you post here to works in same device, strange for me :/

    – mircze
    Nov 24 '18 at 17:28



















  • That's the way how I try to figure out before but not working. Structure which you post here is like in sample project after import to android studio from eclipse project. After create same in my current project I have error which I mentioned above :(

    – mircze
    Nov 23 '18 at 22:14













  • @mircze plz see my edited, which is an example.

    – navylover
    Nov 23 '18 at 22:22






  • 1





    thanks, that fixed my problem, so files from sample has only armeabi version but works fine on my phone. But in my current project I need to specify ndk configuration which you post here to works in same device, strange for me :/

    – mircze
    Nov 24 '18 at 17:28

















That's the way how I try to figure out before but not working. Structure which you post here is like in sample project after import to android studio from eclipse project. After create same in my current project I have error which I mentioned above :(

– mircze
Nov 23 '18 at 22:14







That's the way how I try to figure out before but not working. Structure which you post here is like in sample project after import to android studio from eclipse project. After create same in my current project I have error which I mentioned above :(

– mircze
Nov 23 '18 at 22:14















@mircze plz see my edited, which is an example.

– navylover
Nov 23 '18 at 22:22





@mircze plz see my edited, which is an example.

– navylover
Nov 23 '18 at 22:22




1




1





thanks, that fixed my problem, so files from sample has only armeabi version but works fine on my phone. But in my current project I need to specify ndk configuration which you post here to works in same device, strange for me :/

– mircze
Nov 24 '18 at 17:28





thanks, that fixed my problem, so files from sample has only armeabi version but works fine on my phone. But in my current project I need to specify ndk configuration which you post here to works in same device, strange for me :/

– mircze
Nov 24 '18 at 17:28




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452735%2fandroid-use-so-files-from-other-project%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?