当我在模拟器上测试我的应用程序时,它工作正常,但当我在真实的的Android 10.0(版本)手机上运行应用程序时,日志猫显示错误,我根本无法理解。这是非常令人困惑的,因为它在一部手机上工作正常(较低版本),在另一部手机上不工作(Android 10.0版本)。
我收到的错误如下:
反编译的.class文件,确切地说是字节码版本52.00(Java8)。
在错误选项卡中登录:
2020-02-18 22:08:23.114 22232-22280/? E/AndroidRuntime: FATAL EXCEPTION: Thread-4
Process: com.atmosphericproductiveinnovations.worldage, PID: 22232
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at bt.b(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):2)
at bs.a(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):2)
at bu.a(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):17)
at com.google.maps.api.android.lib6.drd.ak.a(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):5)
at ay.a(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):8)
at ay.run(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):44)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/000000f6/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/000000f6/MapsDynamite.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at dalvik.system.DelegateLastClassLoader.loadClass(DelegateLastClassLoader.java:137)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at bt.b(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):2)
at bs.a(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):2)
at bu.a(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):17)
at com.google.maps.api.android.lib6.drd.ak.a(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):5)
at ay.a(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):8)
at ay.run(:com.google.android.gms.dynamite_mapsdynamite@20104081@20.1.04 (120400-0):44)
2020-02-18 22:08:23.128 22232-22232/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2020-02-18 22:08:23.206 22232-22232/? E/BufferQueueConsumer: disconnect by : com.atmosphericproductiveinnovations.worldage my_pid = 22232
MapsActivity.Java:
package com.atmosphericproductiveinnovations.worldage;
import androidx.fragment.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.BitmapDescriptorFactory;
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 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);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng India = new LatLng(23.52, 78.59);
mMap.addMarker(new MarkerOptions()
.position(India)
.title("India"))
//.setSnippet("Meow. My name is");
.setSnippet("Information-"+"" +
"\n"+"Location:South Asia"+
"\n"+"Population:133.92 crores (2017)"+
"\n"+"GDP:2.6 lakh crores USD (2017):");
mMap.moveCamera(CameraUpdateFactory.newLatLng(India));
mMap.setInfoWindowAdapter(new CustomInfoWindowAdapter(MapsActivity.this));
}
}
Android清单xml文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.atmosphericproductiveinnovations.worldage">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<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">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyD7EYViNqAco_PXl-0CyCgJ6l2eEIzvTzY" />
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
BaseDexClassLoader.class:
package dalvik.system;
import java.io.File;
import java.net.URL;
import java.util.Enumeration;
public class BaseDexClassLoader extends ClassLoader {
public BaseDexClassLoader(String dexPath, File optimizedDirectory, String librarySearchPath, ClassLoader parent) {
throw new RuntimeException("Stub!");
}
protected Class<?> findClass(String name) throws ClassNotFoundException {
throw new RuntimeException("Stub!");
}
protected URL findResource(String name) {
throw new RuntimeException("Stub!");
}
protected Enumeration<URL> findResources(String name) {
throw new RuntimeException("Stub!");
}
public String findLibrary(String name) {
throw new RuntimeException("Stub!");
}
protected synchronized Package getPackage(String name) {
throw new RuntimeException("Stub!");
}
public String toString() {
throw new RuntimeException("Stub!");
}
}
DelegateLastClassLoader.class:
package dalvik.system;
import android.annotation.NonNull;
import android.annotation.Nullable;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
public final class DelegateLastClassLoader extends PathClassLoader {
public DelegateLastClassLoader(String dexPath, ClassLoader parent) {
super((String)null, (ClassLoader)null);
throw new RuntimeException("Stub!");
}
public DelegateLastClassLoader(String dexPath, String librarySearchPath, ClassLoader parent) {
super((String)null, (ClassLoader)null);
throw new RuntimeException("Stub!");
}
public DelegateLastClassLoader(@NonNull String dexPath, @Nullable String librarySearchPath, @Nullable ClassLoader parent, boolean delegateResourceLoading) {
super((String)null, (ClassLoader)null);
throw new RuntimeException("Stub!");
}
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
throw new RuntimeException("Stub!");
}
public URL getResource(String name) {
throw new RuntimeException("Stub!");
}
public Enumeration<URL> getResources(String name) throws IOException {
throw new RuntimeException("Stub!");
}
}
我是英特尔的新手
2条答案
按热度按时间fgw7neuy1#
如果您使用的是com.google.android.gms:play-services-maps:16.0.0或更低版本,并且您的应用面向API级别28(Android 9.0)或更高版本,则必须在AndroidManifest.xml的元素中包含以下声明。
如果您使用的是com.google.android.gms:play-services-maps:16.1.0,则会为您处理此问题,如果您的应用针对的是较低的API级别,则不需要此问题。
指定Apache HTTP遗留库要求
s4n0splo2#
maven clean帮我解决这个问题enter image description here