使用插件時,我已經開發了基於Eclipse的應用程序,我最近開始使用Android工作室工作,當我第一次移動應用程序的所有依存關係並平穩地移動,沒有任何問題缺少清單, 我現在想添加該功能通過Facebook和Twitter分享,但對於Twitter,只要我嘗試在build.gradle中使用任何插件,該清單就會消失。如下面的代碼:在Android Studio中
的build.gradle(項目:項目名稱) 的問題是在該文件中:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: com.android.application
buildscript {
repositories {
jcenter()
//maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
//classpath 'io.fabric.tools:gradle:1.+'
}
}
//apply plugin: 'io.fabric'
allprojects {
repositories {
jcenter()
// maven { url 'https://maven.fabric.io/public' }
}
}
/*dependencies {
compile('com.twitter.sdk.android:twitter:[email protected]') {
transitive = true;
}
}
android {
sourceSets {
main {
manifest.srcFile 'app/src/main/AndroidManifest.xml'
}
}
}*/
的build.gradle(模塊:APP)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '24.0.0 rc4'
defaultConfig {
applicationId "com.nwf.ICDLeKitab"
minSdkVersion 14
targetSdkVersion 14
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile files('libs/icu4j-4_4_2_2.jar')
compile files('libs/jsoup-1.6.3.jar')
compile files('libs/ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar')
compile files('libs/zip4j_1.2.6.jar')
//compile project('com.facebook:facebook-android-sdk-4.0.1')
}
能爲我有人解釋什麼會發生?以及我應該如何在android studio中使用庫和依賴項。
謝謝
你所說的「明顯消失」呢? – Sufian
通常你在你的項目中有:app:manifest和它下面的java。清單部分將不再顯示,但它仍然存在於主文件夾,但在Android Studio後,停止放映,再加上我得到搖籃同步失敗 – coder
發生這種情況時,我嘗試添加任何插件。即使當我添加apply plugin:com.android.application時,正如我在幾個在線示例中看到的,但它也會導致相同的錯誤。 – coder