Я пытаюсь изучить карты Google в Android с помощью Android Studio 3.1.3, и я установил SDK 28. и мой build.gradle файл выглядит так
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.kiran.googlemapsdemo"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'**
implementation 'com.google.android.gms:play-services-maps:15.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
и я не знаю почему, но я получаю красную линию под "реализацией" com.android.support:appcompat-v7:28.0.0-alpha3'
and i only did in this app is just added API key to it.
And My MainActivity.java looks like
package com.example.kiran.googlemapsdemo;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
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.activity_maps);
// 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);
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@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));
}
}
и это файл LOGCAT
07-03 12:53:20.746 24521-24521/? I/.googlemapsdem: Not late-enabling -Xcheck:jni (already on)
07-03 12:53:20.773 24521-24521/? W/.googlemapsdem: Unexpected CPU variant for X86 using defaults: x86
07-03 12:53:21.219 24521-24521/com.example.kiran.googlemapsdemo W/.googlemapsdem: JIT profile information will not be recorded: profile file does not exits.
07-03 12:53:21.220 24521-24521/com.example.kiran.googlemapsdemo I/chatty: uid=10103(com.example.kiran.googlemapsdemo) identical 10 lines
07-03 12:53:21.220 24521-24521/com.example.kiran.googlemapsdemo W/.googlemapsdem: JIT profile information will not be recorded: profile file does not exits.
07-03 12:53:21.244 24521-24521/com.example.kiran.googlemapsdemo I/InstantRun: starting instant run server: is main process
07-03 12:53:21.408 24521-24521/com.example.kiran.googlemapsdemo I/zzbz: Making Creator dynamically
07-03 12:53:21.419 24521-24521/com.example.kiran.googlemapsdemo W/.googlemapsdem: Unsupported class loader
07-03 12:53:21.424 24521-24521/com.example.kiran.googlemapsdemo I/DynamiteModule: Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:220
Selected remote version of com.google.android.gms.maps_dynamite, version >= 220
07-03 12:53:21.473 24521-24521/com.example.kiran.googlemapsdemo W/.googlemapsdem: Unsupported class loader
07-03 12:53:21.475 24521-24521/com.example.kiran.googlemapsdemo W/.googlemapsdem: Skipping duplicate class check due to unsupported classloader
07-03 12:53:21.503 24521-24521/com.example.kiran.googlemapsdemo I/Google Maps Android API: Google Play services client version: 12451000
07-03 12:53:21.510 24521-24521/com.example.kiran.googlemapsdemo I/Google Maps Android API: Google Play services package version: 12848026
07-03 12:53:21.636 24521-24521/com.example.kiran.googlemapsdemo W/.googlemapsdem: Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
07-03 12:53:21.637 24521-24521/com.example.kiran.googlemapsdemo E/.googlemapsdem: The String#value field is not present on Android versions >= 6.0
07-03 12:53:21.834 24521-24548/com.example.kiran.googlemapsdemo D/NetworkSecurityConfig: No Network Security Config specified, using platform default
07-03 12:53:21.966 24521-24521/com.example.kiran.googlemapsdemo D/OpenGLRenderer: HWUI GL Pipeline
07-03 12:53:22.055 24521-24573/com.example.kiran.googlemapsdemo I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
07-03 12:53:22.055 24521-24573/com.example.kiran.googlemapsdemo I/OpenGLRenderer: Initialized EGL, version 1.4
07-03 12:53:22.055 24521-24573/com.example.kiran.googlemapsdemo D/OpenGLRenderer: Swap behavior 1
07-03 12:53:22.056 24521-24573/com.example.kiran.googlemapsdemo W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
07-03 12:53:22.056 24521-24573/com.example.kiran.googlemapsdemo D/OpenGLRenderer: Swap behavior 0
07-03 12:53:22.079 24521-24573/com.example.kiran.googlemapsdemo D/EGL_emulation: eglCreateContext: 0xdd5a3ec0: maj 2 min 0 rcv 2
07-03 12:53:22.089 24521-24573/com.example.kiran.googlemapsdemo D/EGL_emulation: eglMakeCurrent: 0xdd5a3ec0: ver 2 0 (tinfo 0xe5f94840)
07-03 12:53:22.136 24521-24573/com.example.kiran.googlemapsdemo D/EGL_emulation: eglMakeCurrent: 0xdd5a3ec0: ver 2 0 (tinfo 0xe5f94840)
07-03 12:53:22.155 24521-24569/com.example.kiran.googlemapsdemo D/EGL_emulation: eglCreateContext: 0xe0205fc0: maj 1 min 0 rcv 1
07-03 12:53:22.171 24521-24569/com.example.kiran.googlemapsdemo D/EGL_emulation: eglMakeCurrent: 0xe0205fc0: ver 1 0 (tinfo 0xe02038f0)
07-03 12:53:23.266 24521-24548/com.example.kiran.googlemapsdemo E/AndroidRuntime: FATAL EXCEPTION: Thread-8
Process: com.example.kiran.googlemapsdemo, PID: 24521
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at el.b(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):3)
at ek.a(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):4)
at em.a(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):51)
at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):11)
at dw.a(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):16)
at dw.run(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):61)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/system/priv-app/PrebuiltGmsCore/app_chimera/m/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000006/MapsDynamite.apk!/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:126)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at ad.loadClass(:com.google.android.gms.dynamite_dynamiteloader@12848026@12.8.48 (040700-196123505):25)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at el.b(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):3)
at ek.a(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):4)
at em.a(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):51)
at com.google.maps.api.android.lib6.drd.ap.a(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):11)
at dw.a(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):16)
at dw.run(:com.google.android.gms.dynamite_mapsdynamite@12848026@12.8.48 (040700-196123505):61)
07-03 12:53:23.365 24521-24521/com.example.kiran.googlemapsdemo E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
07-03 12:53:23.550 24521-24573/com.example.kiran.googlemapsdemo D/EGL_emulation: eglMakeCurrent: 0xdd5a3ec0: ver 2 0 (tinfo 0xe5f94840)
07-03 12:53:23.974 24521-24571/com.example.kiran.googlemapsdemo W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
07-03 12:53:23.991 24521-24571/com.example.kiran.googlemapsdemo I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
Selected remote version of com.google.android.gms.googlecertificates, version >= 4
07-03 12:53:23.995 24521-24571/com.example.kiran.googlemapsdemo W/.googlemapsdem: Unsupported class loader
07-03 12:53:24.007 24521-24571/com.example.kiran.googlemapsdemo W/.googlemapsdem: Skipping duplicate class check due to unsupported classloader
и мое приложение снова и снова падает. пожалуйста, помогите мне с этим.