如果我們使用我們的本地庫使用System.loadLibrary()
然後SupportMapFragment
剛剛殺死activity
啓動後幾秒鐘。它沒有任何堆棧跟蹤。這是我能收集最好的日誌:奇怪的支持地圖片段行爲
06-10 02:10:01.063 22787-23766/com.myapp.staging E/DynamiteModule: Failed to load module descriptor class: Didn't find class "com.google.android.gms.dynamite.descriptors.com.google.android.gms.googlecertificates.ModuleDescriptor" on path: DexPathList[[zip file "/data/app/com.myapp.staging-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp.staging-1/lib/arm, /data/app/com.myapp.staging-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
06-10 02:10:01.063 22787-23766/com.myapp.staging W/ResourcesManager: getTopLevelResources: /data/app/com.google.android.gms-1/base.apk/1.0 running in com.myapp.staging rsrc of package com.google.android.gms
06-10 02:10:01.063 22787-23766/com.myapp.staging I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:1
06-10 02:10:01.063 22787-23766/com.myapp.staging I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 1
06-10 02:10:01.153 23793-23793/? I/dex2oat: /system/bin/dex2oat --debuggable --compiler-filter=speed --dex-file=/data/user/0/com.google.android.gms/app_chimera/m/00000000/DynamiteModulesA_GmsCore_prodmnc_alldpi_release.apk --oat-file=/data/dalvik-cache/arm/[email protected]@[email protected]@[email protected]@[email protected][email protected]
06-10 02:10:01.153 23793-23793/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm/[email protected]@[email protected]@[email protected]@[email protected][email protected]: Permission denied
06-10 02:10:01.153 23793-23793/? I/dex2oat: dex2oat took 721.250us (threads: 4)
06-10 02:10:01.153 5853-5853/? E/audit: type=1701 msg=audit(1465506601.153:5185): auid=4294967295 uid=10329 gid=10329 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=23766 comm="androidmapsapi-" reason="memory violation" sig=11
06-10 02:10:01.153 3542-4463/? D/libgps: OnGpsExtensionMessage: message_id(1), data(0x7f95455e44), size(2432)
06-10 02:10:01.153 3542-4463/? D/libgps: GpsiHook: API: gpsSvStatusCb(GpsiHookStateGps: e,c,g)
06-10 02:10:01.153 3542-4463/? D/libgps: proxy__gps_sv_status_cb : called
06-10 02:10:01.173 3542-3607/? I/PassiveLocTracker: GPS Satllite Status
06-10 02:10:01.243 3542-4368/? I/WindowState: WIN DEATH: Window{ae4e596 u0 d0 com.myapp.staging/com.myapp.ui.activity.FrameActivity}
06-10 02:10:01.243 3067-4605/? D/libEGL: eglTerminate EGLDisplay = 0x7f6bae1f88
06-10 02:10:01.243 3067-4605/? D/libEGL: eglTerminate EGLDisplay = 0x7f6bae1f88
06-10 02:10:01.243 3542-4286/? D/GraphicsStats: Buffer count: 21
06-10 02:10:01.253 3542-4368/? D/InputDispatcher: Focus left window: 22787
06-10 02:10:01.253 3542-4639/? I/AppOps: sendInfoToFLP, code=41 , uid=10329 , packageName=com.myapp.staging , type=finishOp
06-10 02:10:01.253 3542-4120/? I/ActivityManager: Process com.myapp.staging (pid 22787)(adj 0) has died(114,1020)
06-10 02:10:01.253 3542-3564/? I/WindowState: WIN DEATH: Window{6ba02d0 u0 d0 com.myapp.staging/com.myapp.ui.activity.VisitActivity}
06-10 02:10:01.253 3542-4227/? I/AppOps: sendInfoToFLP, code=42 , uid=10329 , packageName=com.myapp.staging , type=finishOp
06-10 02:10:01.263 3542-4120/? D/ActivityManager: isAutoRunBlockedApp:: com.myapp.staging, Auto Run ON
06-10 02:10:01.263 3542-4120/? W/ActivityManager: Force removing ActivityRecord{6796427 u0 com.myapp.staging/com.myapp.ui.activity.FrameActivity t5324}: app died, no saved state
我花了幾天試圖瞭解是什麼導致它,它似乎如果我們去掉System.loadLibrary()
通話即不使用我們的本地庫,然後SupportMapFragment
工作正常。有沒有什麼辦法可以解決它,而無需刪除我們的本地庫?
編輯: 我創建了一個示例應用程序重現此問題與上面提到的日誌後,我也得到了一些東西,似乎是有用的:
06-14 13:17:28.415 5756-5756/? E/audit: type=1701 msg=audit(1465892248.405:4500): auid=4294967295 uid=10332 gid=10332 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=6431 comm="androidmapsapi-" reason="memory violation" sig=11
EDIT2:
MapsActivity。 java
public class MapsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Go.init(this);
setContentView(R.layout.activity_maps);
}
public void showMap(View view) {
getSupportFragmentManager().beginTransaction().replace(R.id.container, new MapFragment()).commit();
}
}
MapFragment.java
public class MapFragment extends android.support.v4.app.Fragment implements OnMapReadyCallback {
private GoogleMap mMap;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.map_frag, null, false);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager()
.findFragmentById(R.id.maps);
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));
}
}
Go.java
public final class Go {
// init loads libgojni.so and starts the runtime.
public static void init(final Context ctx) {
if (Looper.myLooper() != Looper.getMainLooper()) {
Log.wtf("Go", "Go.init must be called from main thread (thread="+Thread.currentThread().getName()+")");
}
if (running) {
return;
}
running = true;
// TODO(crawshaw): context.registerComponentCallbacks for runtime.GC
System.loadLibrary("gojni");
Go.run(ctx);
new Thread("GoReceive") {
public void run() { Seq.receive(); }
}.start();
}
private static boolean running = false;
private static native void run(Context ctx);
}
這是文件夾結構:
更新Lib有幫助嗎? – PsyGik
'E/dex2oat:無法創建燕麥文件:/data/dalvik-cache/arm/[email protected]@[email protected]@[email protected]@[email protected][email protected]:Permission否認' – Shark
@鯊魚是啊我看到了,但它是什麼?這個日誌不是來自我的應用程序。我能做些什麼來解決它? –