gpt4 book ai didi

actionbarsherlock - 如何使用 actionbarsherlock lib 配置现有项目的 build.gradle 文件?

转载 作者:行者123 更新时间:2023-12-03 16:53:12 27 4
gpt4 key购买 nike

我在 Eclipse 中有一个现有项目 MyProject,它使用库 actionbarsherlock(4.3.1 版)。该项目在 android studio 中编译并运行,但我没有得到构建变体。请帮忙!

这是我的根文件夹(project_workspace)的 setting.gradle 和 build.gradle:

// setting.gradle:
include ':MyProject'
include ':actionbarsherlock'

build.grade:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:gradle:0.4'
}
}

myProject 的 build.gradle:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':C::Users:<myname>:project_workspace:actionbarsherlock')
}

android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}

}

actionbarsherlock 的 build.gradle:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}

android {
compileSdkVersion 14
buildToolsVersion "17.0.0"

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}

我也在这里阅读了很多问答,我查看了gradle示例,但我不明白。
请帮助我,我以前从未与 maven 或 ant 一起工作过!
如果您需要更多信息 -> 告诉我。

最佳答案

我有这样的库的工作项目:

根文件夹 :

设置.gradle:

include ':JazzyListView', ':ABS', ':Volley',':WallCP'

build.gradle: 空

ABS文件夹 :

构建.gradle:
buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}

apply plugin: 'android-library'

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}

android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}

主项目文件夹:

构建.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android'

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':JazzyListView')
compile project(':ABS')
compile project(':Volley')
}

android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

defaultConfig {
versionCode 5
versionName "3.0"
minSdkVersion 8
targetSdkVersion 17
}

sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
}
}


}

关于actionbarsherlock - 如何使用 actionbarsherlock lib 配置现有项目的 build.gradle 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17210143/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com