2017-02-09 39 views
0

Gradle構建完成正確與build.gradle文件下面。Android build.gradle錯誤v13:19.1.0

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 19 
buildToolsVersion "23.0.2" 
defaultConfig { 
    applicationId "com.etu.goglove" 
    minSdkVersion 18 
    targetSdkVersion 18 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
    } 
} 
} 
dependencies { 
compile 'com.android.support:support-v4:19.1.0' 
compile 'com.android.support:support-v13:19.1.0' 

} 

但我想也實現MapsActivity.class

import android.os.Bundle; 
import android.support.v4.app.FragmentActivity; 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.OnMapReadyCallback; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.MarkerOptions; 

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { 

private GoogleMap mMap; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.location_fragment); 
    // Obtain the SupportMapFragment and get notified when the map is ready to be used. 
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() 
      .findFragmentById(R.id.map); 
    mapFragment.getMapAsync(this); 
} 

@Override 
public void onMapReady(GoogleMap googleMap) { 
    mMap = googleMap; 

    // Add a marker in Sydney and move the camera 
    LatLng sydney = new LatLng(-34, 151); 
    mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); 
    mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); 
} 
} 

然後我得到的導入錯誤我做:無法解析符號「機器人」 我也有谷歌播放服務已安裝。然後在文件的build.gradle我補充一下:

compile 'com.google.android.gms:play-services:10.0.0' 

然後我得到這個錯誤:

Warning:Module 'com.android.support:support-v13:19.1.0' depends on one or more Android Libraries but is a jar 

什麼我錯了嗎?該解決方案不是幫助.. solution

回答

0

嘗試:

dependencies { 
compile 'com.android.support:support-v4:23.0.0' 
compile 'com.android.support:support-v13:23.0.0' 
compile 'com.google.android.gms:play-services:10.0.0' 

} 

和:

compileSdkVersion 23 
buildToolsVersion "23.0.2" 
0

嘗試刷新gradle這個建立這樣可能解決問題

0

如果沒有問題,更新您的compileSdkVersion,您可以嘗試將其更改爲類似23.0.2新的東西和相同的版本(compile 'com.android.support:support-v4:23.0.2'compile 'com.android.support:support-v13:23.0.2')。

如果您想堅持使用19出於任何原因,您可以嘗試將buildToolsVersion更改爲19.1.0

最後,嘗試清理該項目並嘗試再次構建。

0

試試這個

compile 'com.google.android.gms:play-services-maps:9.4.0' 
compile 'com.google.android.gms:play-services-location:9.4.0' 
compile 'com.google.android.gms:play-services-auth:9.4.0' 

而更換此

compile 'com.android.support:support-v4:19.1.0' 
compile 'com.android.support:support-v13:19.1.0' 

編譯 'com.android.support:support-v4:23.4.0'

你爲什麼設定目標版本18這是舊的一個

變化至25或24

相關問題