2017-06-17 165 views
-3

我面臨與我的代碼問題。我得到RuntimeException.Kindly請幫助我與此。java.lang.RuntimeException:無法恢復活動:java.lang.NullPointerException

我收到以下錯誤日誌:

06-17 18:11:32.646 13750-13750/? E/Zygote: v2 06-17 18:11:32.646 13750-13750/? E/Zygote: accessInfo : 0 06-17 18:11:33.226 13750-13750/com.example.cocol.timisoara2021 E/MotionRecognitionManager: mSContextService = [email protected] 06-17 18:11:33.226 13750-13750/com.example.cocol.timisoara2021 E/MotionRecognitionManager: motionService = [email protected]d2d3ad4 06-17 18:11:33.226 13750-13750/com.example.cocol.timisoara2021 E/MotionRecognitionManager: motionService = [email protected]d2d3ad4 06-17 18:11:36.566 13750-14348/com.example.cocol.timisoara2021 E/GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. 06-17 18:11:36.666 13750-13750/com.example.cocol.timisoara2021 E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.cocol.timisoara2021, PID: 13750 java.lang.RuntimeException: Unable to resume activity {com.example.cocol.timisoara2021/com.example.cocol.timisoara2021.Main2Activity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.wikitude.common.orientation.internal.a.a()' on a null object reference at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4226) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4328) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3427) at android.app.ActivityThread.access$1100(ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7407) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.wikitude.common.orientation.internal.a.a()' on a null object reference at com.wikitude.architect.ArchitectView.onResume(ProGuard:818) at com.example.cocol.timisoara2021.Main2Activity.onResume(Main2Activity.java:59) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1287) at android.app.Activity.performResume(Activity.java:7015) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4215) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4328)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3427)  at android.app.ActivityThread.access$1100(ActivityThread.java:229)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:7407)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)  這裏是第53行:architectView.onResume();

,代碼:

package com.example.cocol.timisoara2021; 

import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 

import com.wikitude.architect.ArchitectStartupConfiguration; 
import com.wikitude.architect.ArchitectView; 

public class Main2Activity extends AppCompatActivity { 


    private ArchitectView architectView; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main2); 


     this.architectView = (ArchitectView) this.findViewById(R.id.architectView); 

     final ArchitectStartupConfiguration config = new ArchitectStartupConfiguration(); 
     config.setLicenseKey("KKvjW60rM1+LoIdIXdMFdqLeXM8rI6uDFqScJycG9rTXI7GHrRdOx9dycHtxv8Ef6Y6jHB/abqr26X6+eqQXyb+ci4ETEEzCQAQFg3h4/+7DhpwYxY3ayzp3jh/+THcSLe2aKZPAvImpV5Ci0Y7yW891E7d+ionYP0iqJJt6mbNTYWx0ZWRfX05DoEhYDMgfmFUvxnY5fbtk7wnaNnJf4Orfhl+Zfp9DmwItjh/lTSX7MTbprDG700m7vZfWqY1j41pA5vYMiBTiiE1vn6qK66jZ8H5nxjsi3Jp3iAynh2VltO95P6CQy5IKBC9HYdWDtvL/lEmWk1lCOhs4xX8kxwsfD1rxqICVD+zP5Uv+4wnug4++E6vFSwUtDgSN+hY38QnTmh6wXKO5aO7PUm20UXC/7k2lvWNwywwX6LMwF4H4ShnIDQDdWSMSuLshIHvR4SWPNN3r+wK5ImnI/fl/yWmkpH66wB5jWSuE6PvIOSIKz+esUzxprAfQxT6bkpenU/jxNwPaYB8ZbhUHCSCN7vWvGO7z12V/B98xWCGzRdZE5VZqNEOyPA/AfvjSJBmenYpvgm4dw0hgyBQrkoc56P6jOEc8W1aSKdfXfmv0olhbapaEzSoKubZXoZ0ZgPPfjQ6eHtzSVkoOB2fHCVONXseHnjsj9+LYNx3w+DLn0PY="); 
     this.architectView.onCreate(config); 

    } 


    protected void OnPostCreate(Bundle savedInstanceState) { 

     super.onPostCreate(savedInstanceState); 

     architectView.onPostCreate(); 

     try { 
      this.architectView.load("file:///android_asset/POI/index.html"); 
     }catch (Exception e) { 


     } 
    } 

    @Override 
    protected void onPause() { 

     super.onPause(); 
     architectView.onPause(); 
    } 

    @Override 
    protected void onResume() { 
     super.onResume(); 
     architectView.onResume(); 

    } 

    @Override 

    protected void onDestroy() { 

     super.onDestroy(); 
     architectView.onDestroy(); 
    } 




} 

我該如何解決這個問題?

+0

試試這個在的onResume:如果(!architectView = NULL){architectView.onResume();} –

+2

粘貼您的日誌不會像 –

+0

不幸的是,它沒有工作:(同樣的錯誤 – geol

回答

0

您的onPostCreate方法有一個大寫的「O」。正因爲如此,我認爲它從來沒有被調用,這意味着當您調用architectView.onResume時,ArchitectView處於無效狀態。

嘗試:

@Override 
protected void onPostCreate(Bundle savedInstanceState) { 
    super.onPostCreate(savedInstanceState); 

    architectView.onPostCreate(); 
    try { 
     this.architectView.load("file:///android_asset/POI/index.html"); 
    }catch (Exception e) { 
    } 
} 
相關問題