每次开始新项目时,我都不得不反复加载相同的支持库感到沮丧。是否确保在启动Android Studio时始终加载它们?
感谢。
答案 0 :(得分:0)
[编辑]我刚刚从杰克沃顿找到了一个你正在寻找的图书馆。检查SDK Manager插件:https://github.com/JakeWharton/sdk-manager-plugin
某些图书馆存在。您必须在Android-Studio中使用Graddle检查构建项目:
Tips for Graddle
App generator with included libraries
自动加载它的Graddle Test项目(仅举例)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.+'
}
}
// Manifest version information!
def versionMajor = 1
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile 'com.android.support:support-v4:20.+'
compile 'com.android.support:support-annotations:20.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"))
android {
compileSdkVersion 20
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 20
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
buildConfigField "String", "BUILD_TIME", "\"${buildTime}\""
}
signingConfigs {
release {
storeFile file(storeFilePath)
storePassword keystorePassword
keyAlias storeKeyAlias
keyPassword aliasKeyPassword
}
}
buildTypes {
debug {
applicationIdSuffix '.dev'
versionNameSuffix '-dev'
}
release {
signingConfig signingConfigs.release
}
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
答案 1 :(得分:-1)
如果已加载支持的库一次,您可以将Android Studio设置为脱机工作; 打开设置菜单并搜索 Gradle 作为关键字检查离线工作:
如果您在 build.gradle
中更改了相关性,请务必取消选中该复选框