How to override defaultConfig abiFilters in buildTypes
abiFilters
is set in android build.gradle
defaultConfig block.
I'd like to exclude x86
from release buildType, but can't find an easy way to do it
Here is the build.gradle
:
defaultConfig {
ndk {
abiFilters "armeabi", "x86"
moduleName "cipher_v1"
cFlags "-DRELEASE=1"
if (rootProject.ext.has("testCrack")) {
cFlags += " -DTEST_CRACK"
}
if (project.ext.has("authKey") && project.ext.has("androidId")) {
cFlags += "-DAUTH_KEY=\"" + project.ext.authKey + "\""
"-DANDROID_ID=\"" + project.ext.androidId + "\""
}
}
}
buildTypes {
release {
ndk {
abiFilters "armeabi"
}
}
}
Here is what I get:
unzip -l base-release.aar|grep cipher
17752 02-01-1980 00:00 jni/armeabi/libcipher_v1.so
17640 02-01-1980 00:00 jni/x86/libcipher_v1.so
Here is what I really want:
unzip -l base-release.aar|grep cipher
17752 02-01-1980 00:00 jni/armeabi/libcipher_v1.so
I'd like to keep a full abiFilters
in the defautlConfig
block
And specify ones in certain buildType
EDIT 1:
Yes, removing the defaultConfig
and setting abiFilters
in both debug
& release
block would work. But my question is how to utilize the defaultConfig
android gradle android-gradle
add a comment |
abiFilters
is set in android build.gradle
defaultConfig block.
I'd like to exclude x86
from release buildType, but can't find an easy way to do it
Here is the build.gradle
:
defaultConfig {
ndk {
abiFilters "armeabi", "x86"
moduleName "cipher_v1"
cFlags "-DRELEASE=1"
if (rootProject.ext.has("testCrack")) {
cFlags += " -DTEST_CRACK"
}
if (project.ext.has("authKey") && project.ext.has("androidId")) {
cFlags += "-DAUTH_KEY=\"" + project.ext.authKey + "\""
"-DANDROID_ID=\"" + project.ext.androidId + "\""
}
}
}
buildTypes {
release {
ndk {
abiFilters "armeabi"
}
}
}
Here is what I get:
unzip -l base-release.aar|grep cipher
17752 02-01-1980 00:00 jni/armeabi/libcipher_v1.so
17640 02-01-1980 00:00 jni/x86/libcipher_v1.so
Here is what I really want:
unzip -l base-release.aar|grep cipher
17752 02-01-1980 00:00 jni/armeabi/libcipher_v1.so
I'd like to keep a full abiFilters
in the defautlConfig
block
And specify ones in certain buildType
EDIT 1:
Yes, removing the defaultConfig
and setting abiFilters
in both debug
& release
block would work. But my question is how to utilize the defaultConfig
android gradle android-gradle
Answered my own question, but willing to see if any better solutions. Still don't know how to completely override abiFilters from defaultConfig
– Felix.D
Nov 19 '18 at 14:00
add a comment |
abiFilters
is set in android build.gradle
defaultConfig block.
I'd like to exclude x86
from release buildType, but can't find an easy way to do it
Here is the build.gradle
:
defaultConfig {
ndk {
abiFilters "armeabi", "x86"
moduleName "cipher_v1"
cFlags "-DRELEASE=1"
if (rootProject.ext.has("testCrack")) {
cFlags += " -DTEST_CRACK"
}
if (project.ext.has("authKey") && project.ext.has("androidId")) {
cFlags += "-DAUTH_KEY=\"" + project.ext.authKey + "\""
"-DANDROID_ID=\"" + project.ext.androidId + "\""
}
}
}
buildTypes {
release {
ndk {
abiFilters "armeabi"
}
}
}
Here is what I get:
unzip -l base-release.aar|grep cipher
17752 02-01-1980 00:00 jni/armeabi/libcipher_v1.so
17640 02-01-1980 00:00 jni/x86/libcipher_v1.so
Here is what I really want:
unzip -l base-release.aar|grep cipher
17752 02-01-1980 00:00 jni/armeabi/libcipher_v1.so
I'd like to keep a full abiFilters
in the defautlConfig
block
And specify ones in certain buildType
EDIT 1:
Yes, removing the defaultConfig
and setting abiFilters
in both debug
& release
block would work. But my question is how to utilize the defaultConfig
android gradle android-gradle
abiFilters
is set in android build.gradle
defaultConfig block.
I'd like to exclude x86
from release buildType, but can't find an easy way to do it
Here is the build.gradle
:
defaultConfig {
ndk {
abiFilters "armeabi", "x86"
moduleName "cipher_v1"
cFlags "-DRELEASE=1"
if (rootProject.ext.has("testCrack")) {
cFlags += " -DTEST_CRACK"
}
if (project.ext.has("authKey") && project.ext.has("androidId")) {
cFlags += "-DAUTH_KEY=\"" + project.ext.authKey + "\""
"-DANDROID_ID=\"" + project.ext.androidId + "\""
}
}
}
buildTypes {
release {
ndk {
abiFilters "armeabi"
}
}
}
Here is what I get:
unzip -l base-release.aar|grep cipher
17752 02-01-1980 00:00 jni/armeabi/libcipher_v1.so
17640 02-01-1980 00:00 jni/x86/libcipher_v1.so
Here is what I really want:
unzip -l base-release.aar|grep cipher
17752 02-01-1980 00:00 jni/armeabi/libcipher_v1.so
I'd like to keep a full abiFilters
in the defautlConfig
block
And specify ones in certain buildType
EDIT 1:
Yes, removing the defaultConfig
and setting abiFilters
in both debug
& release
block would work. But my question is how to utilize the defaultConfig
android gradle android-gradle
android gradle android-gradle
edited Nov 16 '18 at 1:25
Felix.D
asked Nov 15 '18 at 14:56
Felix.DFelix.D
342312
342312
Answered my own question, but willing to see if any better solutions. Still don't know how to completely override abiFilters from defaultConfig
– Felix.D
Nov 19 '18 at 14:00
add a comment |
Answered my own question, but willing to see if any better solutions. Still don't know how to completely override abiFilters from defaultConfig
– Felix.D
Nov 19 '18 at 14:00
Answered my own question, but willing to see if any better solutions. Still don't know how to completely override abiFilters from defaultConfig
– Felix.D
Nov 19 '18 at 14:00
Answered my own question, but willing to see if any better solutions. Still don't know how to completely override abiFilters from defaultConfig
– Felix.D
Nov 19 '18 at 14:00
add a comment |
3 Answers
3
active
oldest
votes
android {
buildTypes {
debug {
ndk {
abiFilters "armeabi", "x86"
}
}
release {
ndk {
abiFilters "armeabi"
}
}
}
}
productFlavors
also would support dimension abi
.
This would work, but I want to maintain a default abiFilters in defautConfig. And only tweak some of the buildTypes or flavors
– Felix.D
Nov 16 '18 at 1:22
@Felix.D when only configuring build-typerelease
, it might require areset()
. this at least works withsplits
, where one could even build two separete packages. as the issue is being described, it sounds alike as ifabiFilters
would only add filters, but not override them, as expected.
– Martin Zeitler
Nov 16 '18 at 4:10
it's exactly the opposite approach, but whendefaultConfig
would only havearmeabi
configured and build-typedebug
would then addx86
, this might work out.
– Martin Zeitler
Nov 16 '18 at 4:15
Thanks, your comment lead me to a solution
– Felix.D
Nov 19 '18 at 13:50
add a comment |
Feeding a command line option, e.g. "no_x86"
Add below to your
app/build.gradle
defaultConfig {
ndk {
...
if (project.hasProperty("no_x86")) {
abiFilters "armeabi"
} else {
abiFilters "armeabi", "x86"
}
...
}
}
Use below command to generate the APKs without x86 ABI by feeding option
no_x86
to the command.
./gradlew assemble -Pno_x86
but don't feed option
no_x86
to the command if you want to build APKs with x86 abi. As thedefaultConfig
is to keep a full abiFilters per your requirement.
For certain buildType, you can invoke the corresponding build command by feeding or not feeding the
-Pno_x86
property. E.g../gradlew assembleRelease -Pno_x86
Reference: https://stackoverflow.com/a/52980193/8034839
add a comment |
Thanks to Martin, I found a workable solution from this:
when defaultConfig would only have armeabi configured and build-type debug would then add x86, this might work out
I realize that adding wanted abi to debug
is a workaround for removing unwanted abi for release
Works For Me
defaultConfig {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "armeabi"
}
}
buildTypes {
debug {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "x86"
}
}
release {
//ndk {
// abiFilters "armeabi"
//}
}
}
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322169%2fhow-to-override-defaultconfig-abifilters-in-buildtypes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
android {
buildTypes {
debug {
ndk {
abiFilters "armeabi", "x86"
}
}
release {
ndk {
abiFilters "armeabi"
}
}
}
}
productFlavors
also would support dimension abi
.
This would work, but I want to maintain a default abiFilters in defautConfig. And only tweak some of the buildTypes or flavors
– Felix.D
Nov 16 '18 at 1:22
@Felix.D when only configuring build-typerelease
, it might require areset()
. this at least works withsplits
, where one could even build two separete packages. as the issue is being described, it sounds alike as ifabiFilters
would only add filters, but not override them, as expected.
– Martin Zeitler
Nov 16 '18 at 4:10
it's exactly the opposite approach, but whendefaultConfig
would only havearmeabi
configured and build-typedebug
would then addx86
, this might work out.
– Martin Zeitler
Nov 16 '18 at 4:15
Thanks, your comment lead me to a solution
– Felix.D
Nov 19 '18 at 13:50
add a comment |
android {
buildTypes {
debug {
ndk {
abiFilters "armeabi", "x86"
}
}
release {
ndk {
abiFilters "armeabi"
}
}
}
}
productFlavors
also would support dimension abi
.
This would work, but I want to maintain a default abiFilters in defautConfig. And only tweak some of the buildTypes or flavors
– Felix.D
Nov 16 '18 at 1:22
@Felix.D when only configuring build-typerelease
, it might require areset()
. this at least works withsplits
, where one could even build two separete packages. as the issue is being described, it sounds alike as ifabiFilters
would only add filters, but not override them, as expected.
– Martin Zeitler
Nov 16 '18 at 4:10
it's exactly the opposite approach, but whendefaultConfig
would only havearmeabi
configured and build-typedebug
would then addx86
, this might work out.
– Martin Zeitler
Nov 16 '18 at 4:15
Thanks, your comment lead me to a solution
– Felix.D
Nov 19 '18 at 13:50
add a comment |
android {
buildTypes {
debug {
ndk {
abiFilters "armeabi", "x86"
}
}
release {
ndk {
abiFilters "armeabi"
}
}
}
}
productFlavors
also would support dimension abi
.
android {
buildTypes {
debug {
ndk {
abiFilters "armeabi", "x86"
}
}
release {
ndk {
abiFilters "armeabi"
}
}
}
}
productFlavors
also would support dimension abi
.
answered Nov 15 '18 at 19:30
Martin ZeitlerMartin Zeitler
18.7k34372
18.7k34372
This would work, but I want to maintain a default abiFilters in defautConfig. And only tweak some of the buildTypes or flavors
– Felix.D
Nov 16 '18 at 1:22
@Felix.D when only configuring build-typerelease
, it might require areset()
. this at least works withsplits
, where one could even build two separete packages. as the issue is being described, it sounds alike as ifabiFilters
would only add filters, but not override them, as expected.
– Martin Zeitler
Nov 16 '18 at 4:10
it's exactly the opposite approach, but whendefaultConfig
would only havearmeabi
configured and build-typedebug
would then addx86
, this might work out.
– Martin Zeitler
Nov 16 '18 at 4:15
Thanks, your comment lead me to a solution
– Felix.D
Nov 19 '18 at 13:50
add a comment |
This would work, but I want to maintain a default abiFilters in defautConfig. And only tweak some of the buildTypes or flavors
– Felix.D
Nov 16 '18 at 1:22
@Felix.D when only configuring build-typerelease
, it might require areset()
. this at least works withsplits
, where one could even build two separete packages. as the issue is being described, it sounds alike as ifabiFilters
would only add filters, but not override them, as expected.
– Martin Zeitler
Nov 16 '18 at 4:10
it's exactly the opposite approach, but whendefaultConfig
would only havearmeabi
configured and build-typedebug
would then addx86
, this might work out.
– Martin Zeitler
Nov 16 '18 at 4:15
Thanks, your comment lead me to a solution
– Felix.D
Nov 19 '18 at 13:50
This would work, but I want to maintain a default abiFilters in defautConfig. And only tweak some of the buildTypes or flavors
– Felix.D
Nov 16 '18 at 1:22
This would work, but I want to maintain a default abiFilters in defautConfig. And only tweak some of the buildTypes or flavors
– Felix.D
Nov 16 '18 at 1:22
@Felix.D when only configuring build-type
release
, it might require a reset()
. this at least works with splits
, where one could even build two separete packages. as the issue is being described, it sounds alike as if abiFilters
would only add filters, but not override them, as expected.– Martin Zeitler
Nov 16 '18 at 4:10
@Felix.D when only configuring build-type
release
, it might require a reset()
. this at least works with splits
, where one could even build two separete packages. as the issue is being described, it sounds alike as if abiFilters
would only add filters, but not override them, as expected.– Martin Zeitler
Nov 16 '18 at 4:10
it's exactly the opposite approach, but when
defaultConfig
would only have armeabi
configured and build-type debug
would then add x86
, this might work out.– Martin Zeitler
Nov 16 '18 at 4:15
it's exactly the opposite approach, but when
defaultConfig
would only have armeabi
configured and build-type debug
would then add x86
, this might work out.– Martin Zeitler
Nov 16 '18 at 4:15
Thanks, your comment lead me to a solution
– Felix.D
Nov 19 '18 at 13:50
Thanks, your comment lead me to a solution
– Felix.D
Nov 19 '18 at 13:50
add a comment |
Feeding a command line option, e.g. "no_x86"
Add below to your
app/build.gradle
defaultConfig {
ndk {
...
if (project.hasProperty("no_x86")) {
abiFilters "armeabi"
} else {
abiFilters "armeabi", "x86"
}
...
}
}
Use below command to generate the APKs without x86 ABI by feeding option
no_x86
to the command.
./gradlew assemble -Pno_x86
but don't feed option
no_x86
to the command if you want to build APKs with x86 abi. As thedefaultConfig
is to keep a full abiFilters per your requirement.
For certain buildType, you can invoke the corresponding build command by feeding or not feeding the
-Pno_x86
property. E.g../gradlew assembleRelease -Pno_x86
Reference: https://stackoverflow.com/a/52980193/8034839
add a comment |
Feeding a command line option, e.g. "no_x86"
Add below to your
app/build.gradle
defaultConfig {
ndk {
...
if (project.hasProperty("no_x86")) {
abiFilters "armeabi"
} else {
abiFilters "armeabi", "x86"
}
...
}
}
Use below command to generate the APKs without x86 ABI by feeding option
no_x86
to the command.
./gradlew assemble -Pno_x86
but don't feed option
no_x86
to the command if you want to build APKs with x86 abi. As thedefaultConfig
is to keep a full abiFilters per your requirement.
For certain buildType, you can invoke the corresponding build command by feeding or not feeding the
-Pno_x86
property. E.g../gradlew assembleRelease -Pno_x86
Reference: https://stackoverflow.com/a/52980193/8034839
add a comment |
Feeding a command line option, e.g. "no_x86"
Add below to your
app/build.gradle
defaultConfig {
ndk {
...
if (project.hasProperty("no_x86")) {
abiFilters "armeabi"
} else {
abiFilters "armeabi", "x86"
}
...
}
}
Use below command to generate the APKs without x86 ABI by feeding option
no_x86
to the command.
./gradlew assemble -Pno_x86
but don't feed option
no_x86
to the command if you want to build APKs with x86 abi. As thedefaultConfig
is to keep a full abiFilters per your requirement.
For certain buildType, you can invoke the corresponding build command by feeding or not feeding the
-Pno_x86
property. E.g../gradlew assembleRelease -Pno_x86
Reference: https://stackoverflow.com/a/52980193/8034839
Feeding a command line option, e.g. "no_x86"
Add below to your
app/build.gradle
defaultConfig {
ndk {
...
if (project.hasProperty("no_x86")) {
abiFilters "armeabi"
} else {
abiFilters "armeabi", "x86"
}
...
}
}
Use below command to generate the APKs without x86 ABI by feeding option
no_x86
to the command.
./gradlew assemble -Pno_x86
but don't feed option
no_x86
to the command if you want to build APKs with x86 abi. As thedefaultConfig
is to keep a full abiFilters per your requirement.
For certain buildType, you can invoke the corresponding build command by feeding or not feeding the
-Pno_x86
property. E.g../gradlew assembleRelease -Pno_x86
Reference: https://stackoverflow.com/a/52980193/8034839
edited Nov 16 '18 at 1:58
answered Nov 16 '18 at 1:50
shizhenshizhen
3,69741234
3,69741234
add a comment |
add a comment |
Thanks to Martin, I found a workable solution from this:
when defaultConfig would only have armeabi configured and build-type debug would then add x86, this might work out
I realize that adding wanted abi to debug
is a workaround for removing unwanted abi for release
Works For Me
defaultConfig {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "armeabi"
}
}
buildTypes {
debug {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "x86"
}
}
release {
//ndk {
// abiFilters "armeabi"
//}
}
}
add a comment |
Thanks to Martin, I found a workable solution from this:
when defaultConfig would only have armeabi configured and build-type debug would then add x86, this might work out
I realize that adding wanted abi to debug
is a workaround for removing unwanted abi for release
Works For Me
defaultConfig {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "armeabi"
}
}
buildTypes {
debug {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "x86"
}
}
release {
//ndk {
// abiFilters "armeabi"
//}
}
}
add a comment |
Thanks to Martin, I found a workable solution from this:
when defaultConfig would only have armeabi configured and build-type debug would then add x86, this might work out
I realize that adding wanted abi to debug
is a workaround for removing unwanted abi for release
Works For Me
defaultConfig {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "armeabi"
}
}
buildTypes {
debug {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "x86"
}
}
release {
//ndk {
// abiFilters "armeabi"
//}
}
}
Thanks to Martin, I found a workable solution from this:
when defaultConfig would only have armeabi configured and build-type debug would then add x86, this might work out
I realize that adding wanted abi to debug
is a workaround for removing unwanted abi for release
Works For Me
defaultConfig {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "armeabi"
}
}
buildTypes {
debug {
ndk {
//abiFilters "armeabi", "x86"
abiFilters "x86"
}
}
release {
//ndk {
// abiFilters "armeabi"
//}
}
}
answered Nov 19 '18 at 13:58
Felix.DFelix.D
342312
342312
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322169%2fhow-to-override-defaultconfig-abifilters-in-buildtypes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Answered my own question, but willing to see if any better solutions. Still don't know how to completely override abiFilters from defaultConfig
– Felix.D
Nov 19 '18 at 14:00