2017-06-17 2 views
-3

Ich habe Probleme mit meinem Code.Ich bekomme RuntimeException.Kindly bitte helfen Sie mir dabei.java.lang.RuntimeException: Kann die Aktivität nicht fortsetzen: java.lang.NullPointerException

Ich erhalte das folgende Fehlerprotokoll:

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)  Und hier ist die Linie 53: architectView.onResume();

Und der Code:

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(); 
    } 




} 

Wie kann ich dieses Problem beheben?

+0

versuchen, dies in onResume: if (! ArchitectView = null) {architectView.onResume();} –

+2

Ihre Log-Paste nicht Bild –

+0

Leider funktionierte es nicht :(gleichen Fehler – geol

Antwort

0

Ihre onPostCreate-Methode hat einen Großbuchstaben "O". Aus diesem Grund gehe ich davon aus, dass es nie aufgerufen wird, was bedeutet, dass sich die ArchitectView beim Aufruf von architectView.onResume in einem ungültigen Zustand befindet.

Versuchen:

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

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