编辑:解决方案来自错误:java.util.zip.ZipException:重复条目在这里不起作用,因为我没有support-v4模块的问题
我正在尝试构建一个使用SpongyCastle的Android项目,但不幸的是它需要javax.naming来自jndi库的包.我添加了jndi甚至javaEE来使它工作,但gradle仍然有运行项目的问题(构建成功)
我的gradle.build文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "grylls.cryptotexting"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'javax:javaee-api:7.0'
compile files('lib/jndi-1.2.1.jar')
}
Run Code Online (Sandbox Code Playgroud)
Gradle抛出此错误:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.>
com.android.build.api.transform.TransformException:java.util.zip.ZipException:
duplicate entry:javax/mail/AuthenticationFailedException.class
Run Code Online (Sandbox Code Playgroud)
当我试图排除javax.mail来自javax:javaee-api:7.0我:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException: …Run Code Online (Sandbox Code Playgroud) 尝试用C语言编译程序时,我有一些警告:
Run Code Online (Sandbox Code Playgroud)13:20: warning: excess elements in array initializer [enabled by default] 13:20: warning: (near initialization for ‘litera’) [enabled by default] 22:18: warning: excess elements in array initializer [enabled by default] 22:18: warning: (near initialization for ‘liczba’) [enabled by default] 43:1: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat] 45:2: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat] 55:2: warning: format ‘%s’ expects argument of …
我正在尝试创建自己的异常,但遇到了问题......
class MyException extends Exception {
MyException (String w) { super ( w ); }
};
public class RozkladLiczby{
private int[] Array;
RozkladLiczby(int n) throws MyException {
try{
Array = new int[n+2];
}
catch(OutOfMemoryException ex){
throw new MyException ("Not enough memory" );
}
}
}
Run Code Online (Sandbox Code Playgroud)
编译器说它无法在catch中找到符号.
RozkladLiczby.java:16: error: cannot find symbol
catch(OutOfMemoryException ex){
^
symbol: class OutOfMemoryException
location: class RozkladLiczby
1 error
Run Code Online (Sandbox Code Playgroud) 我正在尝试将 NTL 库用于 ZZ 类,并且想使用专用函数。不幸的是,在编译过程中我遇到了很多错误:
[100%] Linking CXX executable hpc5
CMakeFiles/hpc5.dir/main.cpp.o: In function `findX(NTL::ZZ, NTL::ZZ, NTL::ZZ)':
/home/rooter/CLionProjects/hpc5/main.cpp:44: undefined reference to `find_xi(NTL::ZZ, NTL::ZZ)'
/home/rooter/CLionProjects/hpc5/main.cpp:57: undefined reference to `chinese_remainder(NTL::ZZ*, NTL::ZZ*, NTL::ZZ)'
/home/rooter/CLionProjects/hpc5/main.cpp:58: undefined reference to `NTL::operator<<(std::ostream&, NTL::ZZ const&)'
CMakeFiles/hpc5.dir/main.cpp.o: In function `NTL::ZZ::ZZ(NTL::ZZ const&)':
/usr/include/NTL/ZZ.h:58: undefined reference to `_ntl_gcopy(void*, void**)'
CMakeFiles/hpc5.dir/main.cpp.o: In function `NTL::ZZ::operator=(NTL::ZZ const&)':
/usr/include/NTL/ZZ.h:73: undefined reference to `_ntl_gcopy(void*, void**)'
CMakeFiles/hpc5.dir/main.cpp.o: In function `NTL::ZZ::operator=(long)':
/usr/include/NTL/ZZ.h:75: undefined reference to `_ntl_gintoz(long, void**)'
Run Code Online (Sandbox Code Playgroud)
我已经在我的 linux mint 上安装了 libntl-dev,添加set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -lntl" )到我的CMakeLists.txt …
java ×2
android ×1
arrays ×1
c ×1
c++ ×1
char ×1
exception ×1
g++ ×1
gradle ×1
initializer ×1
itext ×1
itextsharp ×1
linux ×1
spongycastle ×1
xps ×1