我試圖添加一個目錄作爲Android Studio(GameBaseUtils)中的依賴項。我已經看到其他的答案只是發佈正確的gradle配置爲他們的特定問題,但我不明白我能如何適應他們的答案我的情況。Android Studio導入模塊Gradle生成錯誤
這裏是我做過什麼:
步驟一:文件 - >導入模塊 - >導航到目錄並選中它。
第二步:文件 - >項目結構 - >模塊 - >選擇我的應用程序 - >依賴關係 - >添加模塊作爲依賴到我的項目。
現在我的代碼沒有任何紅線表示導入模塊時出錯。然而,當我選擇建立我收到以下錯誤:
Gradle: package com.google.example.games.basegameutils does not exist
Gradle: cannot find symbol class BaseGameActivity
Gradle: cannot find symbol variable super
...
這裏是我的應用程序
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
}
我怎樣才能正確導入這個外部庫,可以請你解釋如何和的build.gradle文件你的解決方案爲什麼有效
鏈接的答案鏈接是否更改?它確實幫了我,我想接受這個答案。 – KDEx
我改進了我的答案。第一個是我刪除鏈接的方式。第二個是我會推薦的 – maysi