【发布时间】:2017-08-16 13:46:30
【问题描述】:
我正在尝试将一个库项目(Android Studio 项目)包含在另一个 Android Studio 项目(应用程序)中。 Library 项目有一个 Activity,我想从我的应用程序中启动它。
我在 Gradle Sync 期间遇到错误。
我收到以下错误:
我已经完成了其他 Stackoverflow 问题。
我添加了库项目File->New->New Module->Import Gradle Project。
我在我的图书馆项目中进行了以下更改。 我在库项目的 build.gradle 中添加了以下行。
apply plugin: 'com.android.library'
我已评论 ApplicationID。
在settings.gradle中,我已经添加了
include ":LibraryName"
在App的build.gradle中,我已经添加了
compile project(":LibraryName")
我在这里缺少什么?
编辑:添加应用的 Build.gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.viga.nativeapp"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(":VimeoVideoPlayer")
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
}
Settings.gradle
include ':app', ':VimeoVideoPlayer'
【问题讨论】:
-
发布您的应用 gradle 和设置 gradle
-
@BhuvaneshBs:添加了 build.gradle。 settings.gradle 只有以下行 include ':app', ':VimeoVideoPlayer'
-
发布 setting.gradle 也
-
settings.gradle 只有一行,我贴出来了。谢谢
-
如果您的项目目录中有 VimoVideoPlayer,则您的初始化正确。那么你的错误来自 Vimeo 库。
标签: android android-studio unity3d gradle