When starting the fragment in my application, this appears:
android.view.InflateException: Binary XML file line # 9: Binary XML file line # 9: Error inflating class fragment Caused by: android.view.InflateException: Binary XML file line # 9: Error inflating class fragment Caused by: android.support.v4.app.Fragment $ InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: calling Fragment constructor caused an exception at android.support.v4.app.Fragment.instantiate (Fragment.java:386) at android.support.v4.app.FragmentContainer.instantiate (FragmentContainer.java:33) at android.support.v4.app.Fragment $ 2.instantiate (Fragment.java:2320) at android.support.v4.app.FragmentManagerImpl.onCreateView (FragmentManager.java:3706) at android.view.LayoutInflater $ FactoryMerger.onCreateView (LayoutInflater.java:189) at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:794) at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:752) at android.view.LayoutInflater.rInflate (LayoutInflater.java:883) at android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:846) at android.view.LayoutInflater.inflate (LayoutInflater.java:522) at android.view.LayoutInflater.inflate (LayoutInflater.java:430) at com.example.ernes.programa.Maps.onCreateView (Maps.java:35) at android.support.v4.app.Fragment.performCreateView (Fragment.java:2346) at android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1428) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState (FragmentManager.java:1759) at android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1827) at android.support.v4.app.BackStackRecord.executeOps (BackStackRecord.java:797) at android.support.v4.app.FragmentManagerImpl.executeOps (FragmentManager.java:2596) at android.support.v4.app.FragmentManagerImpl.executeOpsTogether (FragmentManager.java:2383) at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute (FragmentManager.java:2338) at android.support.v4.app.FragmentManagerImpl.execPendingActions (FragmentManager.java:2245) at android.support.v4.app.FragmentManagerImpl $ 1.run (FragmentManager.java:703) at android.os.Handler.handleCallback (Handler.java:754) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (Looper.java:165) at android.app.ActivityThread.main (ActivityThread.java:6365) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:883) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:773) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0 (Native Method) at java.lang.reflect.Constructor.newInstance (Constructor.java:430) at android.support.v4.app.Fragment.instantiate (Fragment.java:364) ... 28 more Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom / google / android / gms / maps / SupportMapFragment $ zzb; at com.google.android.gms.maps.SupportMapFragment. (Unknown Source) ... 31 more Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment $ zzb at java.lang.VMClassLoader.findLoadedClass (Native Method) at java.lang.ClassLoader.findLoadedClass (ClassLoader.java:742) at java.lang.ClassLoader.loadClass (ClassLoader.java:362) at java.lang.ClassLoader.loadClass (ClassLoader.java:312) ... 32 more Caused by: java.lang.IllegalAccessError: Class com.google.android.gms.dynamic.zza extended by class com.google.android.gms.maps.SupportMapFragment $ zzb is inaccessible (declaration of 'com.google.android.gms.maps.SupportMapFragment $ zzb' appears in /data/app/com.example.ernes.programa-1/base.apk) ... 32 more
My Xml is this:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Maps">
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map1"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
I have researched even in English and I can not find the solution, I have already tried the other questions similar to this but it does not work, it is assumed that when opening the fragment google maps should appear but no, my activity Maps is correct that I already verify it thousands of times, I hope and you can help me, Thanks for your attention.
build.glradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.ernes.yovigilo"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.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'
implementation 'com.google.android.gms:play-services-maps:8.1.0'
implementation 'com.android.support:support-annotations:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}