我正在尝试使用gradle 导入https://github.com/Kickflip/kickflip-android-sdk到我的android构建中,我得到:
意外的顶级异常:com.android.dex.DexException:多个dex文件定义Lorg/apache/commons/codec/binary/Base64;
Commons.codec是我的项目的依赖项,但不是直接的翻转项目,我认为它来自其中的一个罐子.如果我打开Kickflip的classes.jar,我可以看到.class文件.
如何排除从kickflip导入Base64.class到最终版本?我已经看过使用ziptree来排除东西,但却无法获得任何工作.
谢谢
我的build.gradle是:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
android.applicationVariants.all{ variant ->
// This is an annoying …Run Code Online (Sandbox Code Playgroud) 我知道有很多关于共享和静态库的用例的问题,这个问题与此无关.我问的是存储在磁盘上的文件格式的差异.
为什么问题是,两者之间有什么区别?或者它们是否完全相同,仅在使用方面有所不同?
我认为它们不一样,因为在共享库上运行'nm'需要-D标志.显然,它需要做一些不同的事情.为什么?
它们都是ELF文件吗?
共享库可以包含某些依赖路径的唯一区别是什么?
我正在创建一个库并使用objcopy来更改符号从全局到本地的可见性,以避免导出一堆内部符号.如果我--undefined在链接时使用该标志从库中引入一个未使用的符号,GCC会给我以下错误:
`_ZStorSt13_Ios_OpenmodeS_' referenced in section `.text' of ./liblibrary.a(library_stripped.o): defined in discarded section `.text._ZStorSt13_Ios_OpenmodeS_[_ZStorSt13_Ios_OpenmodeS_]' of ./liblibrary.a(library_stripped.o)
Run Code Online (Sandbox Code Playgroud)
以下是重现该问题的两个源文件和makefile.
stringstream.cpp:
#include <iostream>
#include <sstream>
int main() {
std::stringstream messagebuf;
messagebuf << "Hello world";
std::cout << messagebuf.str();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
library.cpp:
#include <iostream>
#include <sstream>
extern "C" {
void keepme_lib_function() {
std::stringstream messagebuf;
messagebuf << "I'm a library function";
std::cout << messagebuf.str();
}}
Run Code Online (Sandbox Code Playgroud)
Makefile文件:
CC = g++
all: executable
#build a test program that uses stringstream
stringstream.o : stringstream.cpp
$(CC) -g -O0 …Run Code Online (Sandbox Code Playgroud) 为什么从 float max 中减去 1 会返回一个合理的值,而向 float min 中加 1 会返回 1?
我认为,如果您添加或减去一个小于该特定量级的 epsilon 的值,则不会发生任何事情,也不会增加或减少。
这是我用没有标志的 g++ 编译并在 x86_64 上运行的代码。
#include <limits>
#include <iostream>
int main() {
float min = std::numeric_limits<float>::min() + 1;
float max = std::numeric_limits<float>::max() - 1;
std::cout << min << std::endl << max << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出这个:
1
3.40282e+38
Run Code Online (Sandbox Code Playgroud)
我希望它输出这个:
-3.40282e+38
3.40282e+38
Run Code Online (Sandbox Code Playgroud)