4

I'm using the Google API to build a maps application. I get this error:

E/zygote: The String#value field is not present on Android versions >= 6.0

I do not know how to get rid of this. I have searched in all sites including this:

The String#value field is not present on Android versions >= 6.0

Also no solution was published.

But I'm not using any kind of fire base. I would appreciate any kind of help.

Logcat with the error:

Selected remote version of com.google.android.gms.maps_dynamite, version >= 220 07-03 21:40:15.346 22106- 22106/com.example.sislarodriguez.aplicacionessimilaresv1 W/zygote: Unsupported class loader 07-03 21:40:15.356 22106- 22106/com.example.sislarodriguez.aplicacionessimilaresv1 W/zygote: Skipping duplicate class check due to unsupported classloader 07-03 21:40:15.385 22106- 22106/com.example.sislarodriguez.aplicacionessimilaresv1 I/Google Maps Android API: Google Play services client version: 12451000 07-03 21:40:15.393 22106- 22106/com.example.sislarodriguez.aplicacionessimilaresv1 I/Google Maps Android API: Google Play services package version: 12685026 07-03 21:40:15.478 22106- 22106/com.example.sislarodriguez.aplicacionessimilaresv1 E/zygote: The String#value field is not present on Android versions >= 6.0 07-03 21:40:15.572 22106- 22111/com.example.sislarodriguez.aplicacionessimilaresv1 I/zygote: Do full code cache collection, code=494KB, data=295KB 07-03 21:40:15.575 22106- 22111/com.example.sislarodriguez.aplicacionessimilaresv1 I/zygote: After code cache collection, code=493KB, data=263KB 07-03 21:40:15.663 22106- 22148/com.example.sislarodriguez.aplicacionessimilaresv1 D/NetworkSecurityConfig: No Network Security Config specified, using platform default 07-03 21:40:15.712 22106- 22111/com.example.sislarodriguez.aplicacionessimilaresv1 I/zygote: Do partial code cache collection, code=494KB, data=271KB After code cache collection, code=494KB, data=271KB Increasing code cache capacity to 2MB

The Fragment where I load the map.

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.MapsInitializer;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class FragmentShops extends Fragment {

MapView mMapView;
private GoogleMap googleMap;


@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_shops, container, false);

    mMapView = (MapView) view.findViewById(R.id.mapView);
    mMapView.onCreate(savedInstanceState);

    mMapView.onResume();

    try {
        MapsInitializer.initialize(getActivity().getApplicationContext());
    } catch (Exception e) {
        e.printStackTrace();
    }

    mMapView.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap mMap) {

            googleMap = mMap;
            //googleMap.setMyLocationEnabled(false);

            // For dropping a marker at a point on the Map
            LatLng simi = new LatLng(19.37,-99.14);
            googleMap.addMarker(new MarkerOptions().position(simi).title("Marker Title").snippet("Marker Description"));

            // For zooming automatically to the location of the marker
            CameraPosition cameraPosition = new CameraPosition.Builder().target(simi).zoom(15).build();
            googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
        }
    });


    return view;
}

@Override
public void onResume() {
    super.onResume();
    mMapView.onResume();
}

@Override
public void onPause() {
    super.onPause();
    mMapView.onPause();
}

@Override
public void onDestroy() {
    super.onDestroy();
    mMapView.onDestroy();
}

@Override
public void onLowMemory() {
    super.onLowMemory();
    mMapView.onLowMemory();
}
}

My layout fragment

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".FragmentShops">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:layout_marginBottom="4dp"
    android:layout_marginLeft="4dp"
    android:layout_marginRight="4dp"
    android:layout_marginTop="4dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="2dp"
        android:layout_marginBottom="2dp"
        android:background="@drawable/sb_ovalframe">

        <AutoCompleteTextView
            android:id="@+id/au_searchunit"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_weight="2.5"
            android:background="@android:color/transparent"
            android:completionThreshold="1"
            android:gravity="start"
            android:imeOptions="actionSearch"
            android:inputType="text"
            android:hint="@string/shopsearch"
            android:textSize="@dimen/title_size" />

        <ImageButton
            android:id="@+id/btn_searchunit"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="@drawable/btn_searchoval"
            android:gravity="center"
            app:srcCompat="@drawable/icon_search" />
    </TableRow>

    <ImageView
        android:id="@+id/separator"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        app:srcCompat="@android:color/darker_gray"
        android:contentDescription="@string/separator"
        android:layout_marginBottom="4dp"/>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="1dp">

        <com.google.android.gms.maps.MapView
            android:id="@+id/mapView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </FrameLayout>


</LinearLayout>
</android.support.constraint.ConstraintLayout>

My AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sislarodriguez.aplicacionessimilaresv1">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".StartActivity"
        android:theme="@style/StartScreenTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" />
    <activity android:name=".LoginActivity" />
    <activity
        android:name=".StatusJobs"
        android:label="@string/notificaciones"
        android:theme="@style/ActiveBar" />

     <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="MQpD4IjP84dibMQpD4qwbIjP8h1uxHT4NOTREAL" /> 

    <activity android:name=".ConfigNotificationActivity"></activity>
</application>

</manifest>

My build.gradle Module app

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.example.sislarodriguez.aplicacionessimilaresv1"
    minSdkVersion 19
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
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:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-vector-drawable:27.1.1'
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'
implementation files('libs/MPAndroidChart-v3.0.3.jar')
implementation 'com.android.support:cardview-v7:27.1.1'
}

Thanks in advance.

Roga Lu
  • 162
  • 1
  • 3
  • 14
  • Hi, did you ever find a solution for this problem? – ItWillDo Jul 17 '18 at 20:09
  • 3
    Nop. It still there. But it seems the project is functional. – Roga Lu Jul 17 '18 at 20:14
  • Yeah, seems you're right. For future reference, my main issue seemed to be the fact that I was re-using my old mechanism based on MapView. Once I switched over to a SupportMapFragment as stated in the documentation, it started working again. – ItWillDo Jul 17 '18 at 20:51
  • @RogaLu, Facing the same problem, please let me know if you find any solution to this. though the project is working fine. – Jay Dangar Sep 26 '18 at 07:30
  • No solution, I finished the project and did not fix it. Sorry good luck. – Roga Lu Sep 27 '18 at 22:08

2 Answers2

1

I had a similar problem when running my app on Android 9. This SO answer worked for me: https://stackoverflow.com/a/52181547/6363572

You can try adding the following line in AndroidManifest.xml:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>
0

I had a similar problem, and it was resolved by running it in an emulator with Google Play enabled and updated. (Google maps will not run without an updated Google Play Store.)

Basically create a new Virtual Device that has Google Play (not just Google API). Alternatively, use USB debugging with an actual device.

See This Question for details.