如何在androidstudio的现有Android项目中包含java库
我想把它包括在我现有的android项目中,但无法做到这一点。 已经尝试了如何在androidstudio的现有Android项目中包含java库,java,android,android-studio,android-library,Java,Android,Android Studio,Android Library,我想把它包括在我现有的android项目中,但无法做到这一点。 已经尝试了 但是没有运气。根据我的项目要求,我不会使用compile com.nulab inc:zxcvbn:1.2.2,因为我的项目需要源代码 我的身材,格雷德尔 apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion '24.0.3' defaultConfig {
但是没有运气。根据我的项目要求,我不会使用compile com.nulab inc:zxcvbn:1.2.2,因为我的项目需要源代码 我的身材,格雷德尔
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
defaultConfig {
applicationId "xx.xxx.xx"
minSdkVersion 14
targetSdkVersion 24
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
lintOptions {
abortOnError false
}
productFlavors {
}
}
repositories {
mavenCentral()
maven { url 'http://guardian.github.com/maven/repo-releases' }
}
dependencies {
compile files('libs/xx-3.0.2.jar')
compile files('libs/xx-android-sdk-1.6.3.jar')
compile project(':utilities')
compile project(path: ':common')
compile project(':common')
compile 'com.google.http-client:google-http-client-gson:1.19.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.android.gms:play-services-base:9.0.2'
compile 'com.google.android.gms:play-services-analytics:9.0.2'
compile 'com.google.android.gms:play-services-wearable:9.0.2'
compile 'com.google.android.gms:play-services-auth:9.0.2'
compile 'com.google.apis:google-api-services-drive:v2-rev164-1.20.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.xx.xx:xx:1.2.2'
compile 'com.x.x:x-compiler:1.2.2'
compile 'com.x.x:x-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.google.android.gms:play-services-appindexing:9.0.2'
}
android {
useLibrary 'org.apache.http.legacy'
}
configurations {
all*.exclude group: 'com.google.guava', module: 'guava-jdk5'
}
您应该为android项目导入新模块,请按照以下步骤添加新模块
1.Go to file -> New - > Import Module
然后选择ZXCVN库位置路径并单击“完成”。这将为您现有的android项目添加一个新模块
然后,您应该向项目依赖项添加一个新模块,即(zxcvn库)来实现这一点
2.Click project structure options - > dependency select your zxcvbn library and click ok and synch project
现在,您的java库包含在android项目中您需要
mavenCentral()
作为gradle中的报告file@cricket_007:在zxcvbn4j/build.gradle()中提到了mavenCentral()。在我的项目gradle mavenCentral()中也提到了。请显示你的gradle文件-不管你链接的文件中有什么内容to@cricket_007:现在你可以看到我的gradle文件了。我已经试过了,但不起作用。当我指向zxcvbn文件夹时,Android studio会显示消息“请提供模块”,如果我指向build.gradle,则其仅导入的gradle文件格式不正确。那么可能是您指向了错误的文件夹或错误的库,而Android studio不接受该文件夹或库