我的第一个应用程序存在一些问题..
稍后会出现错误日志,SplashActivity(我的测试介绍)和FullscreenActivity,我将从intent = new Intent(SplashActivity.this, FullscreenActivity.class);
开始,但我会收到一个FC和大错误日志。我缩短了一点,如果需要完整的日志,我可以发表评论或更新主题!
希望你可以帮助我,我搜索了几个小时但没有找到解决方案..
亲切地问候
svansolo
日志:
03/01 03:36:19: Launching app
$ adb shell am start -n "engelsschmidt.runtheropefinal/engelsschmidt.runtheropefinal.SplashActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: engelsschmidt.runtheropefinal.test | engelsschmidt.runtheropefinal
Connecting to engelsschmidt.runtheropefinal
W/ActivityThread: Application engelsschmidt.runtheropefinal is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/art: Debugger is active
Connected to the target VM, address: 'localhost:8605', transport: 'socket'
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1466)
W/System: ClassLoader referenced unknown path: /data/app/engelsschmidt.runtheropefinal-1/lib/arm
I/InstantRun: Instant Run Runtime started. Android package is engelsschmidt.runtheropefinal, real application class is null.
W/System: ClassLoader referenced unknown path: /data/app/engelsschmidt.runtheropefinal-1/lib/arm
D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5860)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5452)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5391)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/data/engelsschmidt.runtheropefinal/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_da4b7ee275c24adb76e999a72b3b1d1271afc7ad-classes.dex)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5860)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5452)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5391)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
I/FA: App measurement is starting up, version: 9080
I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
D/FA: Debug logging enabled
D/FA: AppMeasurement singleton hash: 165856110
V/FA: Collection enabled
V/FA: App package, google app id: engelsschmidt.runtheropefinal, 1:998250257852:android:fddd73d655be689d
V/FA: Registered activity lifecycle callback
D/FirebaseApp: Initialized class com.google.android.gms.measurement.AppMeasurement.
I/FirebaseInitProvider: FirebaseApp initialization successful
V/FA: Using measurement service
V/FA: Connecting to remote service
V/FA: onActivityCreated
V/GoogleSignatureVerifier: com.google.android.gms signature not valid. Found:
MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMw
EQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29n
bGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEz
MzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYw
FAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwt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H78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3Wf
MBEmh/9iFBDAaTCK
V/FA: Activity resumed, time: 55018254
V/FA: Activity paused, time: 55018292
D/FirebaseApp: Notifying background state change listeners.
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 1
E/FA: Task exception on worker thread: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/data/engelsschmidt.runtheropefinal/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_da4b7ee275c24adb76e999a72b3b1d1271afc7ad-classes.dex): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
D/FA: Application backgrounded. Logging engagement
I/FA: Tag Manager is not found and thus will not be used
D/FA: Logging event (FE): _e, Bundle[{_o=auto, _et=14376}]
E/FA: Task exception on worker thread: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/data/engelsschmidt.runtheropefinal/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_da4b7ee275c24adb76e999a72b3b1d1271afc7ad-classes.dex): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
D/FirebaseApp: Notifying background state change listeners.
V/FA: onActivityCreated
D/ApplicationLoaders: ignored Vulkan layer search path /data/app/com.google.android.gms-1/lib/arm:/system/fake-libs:/data/app/com.google.android.gms-1/base.apk!/lib/armeabi-v7a for namespace 0xb6d5b090
W/System: ClassLoader referenced unknown path:
D/ApplicationLoaders: ignored Vulkan layer search path /data/app/com.google.android.gms-1/lib/arm:/system/fake-libs:/data/app/com.google.android.gms-1/base.apk!/lib/armeabi-v7a for namespace 0xb6d5b0d0
W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000006/n/armeabi-v7a
W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000006/n/armeabi
D/AndroidRuntime: Shutting down VM
I/art: Do partial code cache collection, code=30KB, data=28KB
I/art: After code cache collection, code=27KB, data=27KB
I/art: Increasing code cache capacity to 128KB
E/AndroidRuntime: FATAL EXCEPTION: main
Process: engelsschmidt.runtheropefinal, PID: 16317
java.lang.RuntimeException: Unable to start activity ComponentInfo{engelsschmidt.runtheropefinal/engelsschmidt.runtheropefinal.FullscreenActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at engelsschmidt.runtheropefinal.FullscreenActivity.onCreate(FullscreenActivity.java:25)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Disconnected from the target VM, address: 'localhost:8605', transport: 'socket'
SplashActivity:(“主要活动”)
package engelsschmidt.runtheropefinal;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class SplashActivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread logoTimer = new Thread(){
public void run(){
try{
sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
Intent intent;
intent = new Intent(SplashActivity.this, FullscreenActivity.class);
startActivity(intent);
SplashActivity.this.finish();
}
}
};
logoTimer.start();
}
@Override
protected void onPause(){
super.onPause();
finish();
}
}
FullscreenActivity: -
package engelsschmidt.runtheropefinal;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
public class FullscreenActivity extends Activity implements View.OnClickListener {
private static final boolean AUTO_HIDE = true;
private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
private static final int UI_ANIMATION_DELAY = 300;
private final Handler mHideHandler = new Handler();
private View mContentView;
private View mControlsView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fullscreen);
mVisible = true;
mContentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
toggle();
}
});
Button button_new_game = (Button) findViewById(R.id.button_new_game);
Button button_highscore = (Button) findViewById(R.id.button_highscore);
button_new_game.setOnClickListener(this);
button_highscore.setOnClickListener(this);
}
private final Runnable mHidePart2Runnable = new Runnable() {
@SuppressLint("InlinedApi")
@Override
public void run() {
mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}
};
private final Runnable mShowPart2Runnable = new Runnable() {
@Override
public void run() {
//ActionBar actionBar = getSupportActionBar();
//if (actionBar != null) {
// actionBar.show();
//}
mControlsView.setVisibility(View.VISIBLE);
}
};
private boolean mVisible;
private final Runnable mHideRunnable = new Runnable() {
@Override
public void run() {
hide();
}
};
private final View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (AUTO_HIDE) {
delayedHide(AUTO_HIDE_DELAY_MILLIS);
}
return false;
}
};
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
delayedHide(100);
}
private void toggle() {
if (mVisible) {
hide();
} else {
show();
}
}
private void hide() {
//ActionBar actionBar = getSupportActionBar();
//if (actionBar != null) {
// actionBar.hide();
//}
mControlsView.setVisibility(View.GONE);
mVisible = false;
mHideHandler.removeCallbacks(mShowPart2Runnable);
mHideHandler.postDelayed(mHidePart2Runnable, UI_ANIMATION_DELAY);
}
@SuppressLint("InlinedApi")
private void show() {
mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
mVisible = true;
mHideHandler.removeCallbacks(mHidePart2Runnable);
mHideHandler.postDelayed(mShowPart2Runnable, UI_ANIMATION_DELAY);
}
private void delayedHide(int delayMillis) {
mHideHandler.removeCallbacks(mHideRunnable);
mHideHandler.postDelayed(mHideRunnable, delayMillis);
}
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.button_new_game:
Intent fullscreenSecondActivity = new Intent(FullscreenActivity.this, FullscreenSecondActivity.class);
startActivity(fullscreenSecondActivity);
this.finish();
break;
case R.id.button_highscore:
Intent fullscreenThirthActivity = new Intent(FullscreenActivity.this, FullscreenThirthActivity.class);
startActivity(fullscreenThirthActivity);
this.finish();
break;
//case R.id.button_charakter:
}
}
public void highscore(View view) {
}
public void new_game(View view) {
}
public void charakter(View view) {
}
}
答案 0 :(得分:0)
mContentView
为空。
在onclick功能之前。您需要将mContentView
定义为您正在使用的任何布局。
例如
mContentView = (RelativeLayout) findViewById(R.id.thisisidoflayout);
答案 1 :(得分:0)
您在FullScreenActivity中的一个视图为空。
mContentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
toggle();
}
});
mContentView从未初始化。