2017-06-17 3 views
-3

Je suis confronté à un problème avec mon code. Je reçois RuntimeException.Kindly s'il vous plaît aidez-moi avec cela.java.lang.RuntimeException: Impossible de reprendre l'activité: java.lang.NullPointerException

Je reçois le journal d'erreur suivant:

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)  Et voici la ligne 53: architectView.onResume();

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




} 

Comment puis-je résoudre ce problème?

+0

Essayez ceci dans onResume: if (! ArchitectView = null) {architectView.onResume();} –

+2

coller votre journal ne l'image –

+0

Malheureusement, il ne fonctionne pas :(même erreur – geol

Répondre

0

Votre méthode onPostCreate a un "O" majuscule. Pour cette raison, je suppose qu'il n'est jamais appelé, ce qui signifie que ArchitectView est dans un état invalide lorsque vous appelez architectView.onResume.

Essayez:

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

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