簡體   English   中英

如何修復android上地圖應用程序的build.gradle

[英]how to fix build.gradle for map application on android

我正在開發一個基本的地圖示例,但我在使用 android studio 時遇到了麻煩。

我收到此錯誤:

Error:(9, 0) Cause: startup failed:build file 'C:\Users\Tugrul\AndroidStudioProjects\ServiceTextSender\build.gradle': 9: expecting '}', found ':' @ line 9, column 31.
    compile ‘com.android.support:appcompat-v7:+’1 error

這里是我的 build.gradle 文件中的錯誤資源(依賴項:

dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
    compile ‘com.android.support:appcompat-v7:+’
    compile ‘com.google.android.gms:play-services:3.1.36′

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

我怎樣才能解決這個問題? 請問你能幫幫我嗎? 我在使用 Android Studio 時遇到了麻煩。 我遇到了這個錯誤。

我認為你的問題是字符錯誤。 ' 和 ' 是不同的。 嘗試改變這個:

classpath 'com.android.tools.build:gradle:1.3.0'
compile ‘com.android.support:appcompat-v7:+’
compile ‘com.google.android.gms:play-services:3.1.36′

對此

classpath 'com.android.tools.build:gradle:1.3.0'
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:3.1.36'

編輯:

這些是 gradle 文件:

你需要添加你的

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.google.android.gms:play-services:3.1.36'
}

行到模塊特定的 build.gradle 文件,如上所示。

關於錯誤:看起來您將此添加到錯誤的 gradle 文件中,應該添加到應用程序的 gradle 文件(應用程序文件夾中的那個),而不是模塊(最上面的那個)。 頂部指定要使用的 gradle 插件,正如您在此處列出的那樣,我假設您正在編輯錯誤的 build-gradle 文件。 如果您改為檢查包含src 文件夾(不在src 內)的同一目錄,您將找到應用程序的依賴項部分,您可以在其中添加該行。

和/或您只是使用錯誤的字符應該是'而不是'

建議的更簡單的解決方案:在啟動新項目時使用模板創建新的 Google 地圖活動,或右鍵單擊您的項目包並選擇(在彈出菜單中):

New -> Google -> Google Maps Activity

一切都會為你准備好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM