Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android WatchFace示例-如何运行_Android_Nullpointerexception_Sample - Fatal编程技术网

Android WatchFace示例-如何运行

Android WatchFace示例-如何运行,android,nullpointerexception,sample,Android,Nullpointerexception,Sample,我进口了表盘样品 但是,我无法运行手机应用程序,也无法将watch faces安装到模拟器。 该示例项目的手机应用程序没有默认活动,但当我尝试启动它的任何活动时,它会在ComponentName上给出Null异常 Caused by: java.lang.NullPointerException at com.example.android.wearable.watchface.DigitalWatchFaceCompanionConfigActivity.onCreate(Di

我进口了表盘样品 但是,我无法运行手机应用程序,也无法将watch faces安装到模拟器。 该示例项目的手机应用程序没有默认活动,但当我尝试启动它的任何活动时,它会在ComponentName上给出Null异常

Caused by: java.lang.NullPointerException
        at com.example.android.wearable.watchface.DigitalWatchFaceCompanionConfigActivity.onCreate(DigitalWatchFaceCompanionConfigActivity.java:77)
        at android.app.Activity.performCreate(Activity.java:5231)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)    
第77行是onCreate方法中的最后一行:

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

    mPeerId = getIntent().getStringExtra(WatchFaceCompanion.EXTRA_PEER_ID);
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Wearable.API)
            .build();

    ComponentName name = getIntent().getParcelableExtra(
            WatchFaceCompanion.EXTRA_WATCH_FACE_COMPONENT);
    TextView label = (TextView)findViewById(R.id.label);
    label.setText(label.getText() + " (" + name.getClassName() + ")");
}
我将可穿戴应用程序设置为不运行任何活动,因此它应该在模拟器上安装watch faces。但是,is没有安装任何东西

我希望这不是一个完全破碎的样本,我只是做了一些非常错误的事情,只是可以找出什么?
简单的“hello world”应用程序工作正常,在同一台机器上运行时安装无问题。

正常,已解决。这基本上是某种模拟器或/和工作室的小故障。我删除了旧的可穿戴模拟器,创建了一个新的,并将其连接到手机上。一切正常安装之后