error: WatchKit Extension doesn't contain any WatchKit apps.
Verify that the value of WKWatchKitApp in your WatchKit App's Info.plist is set to YES.
我一直收到这个错误,不知道为什么在这里搜索了所有其他问题后,花了很长时间才弄清楚这一点.
我希望这种相对布局最终在底部加载广告.
public class Main extends Activity {
RelativeLayout mLayout;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mLayout = (RelativeLayout) findViewById(R.layout.main);
ImageView View = new ImageView(this, null); //example view
mLayout.addView(View);
Run Code Online (Sandbox Code Playgroud)
然后当调用mLayout时,Null指针发生在下面
RelativeLayout.LayoutParams rparams = (LayoutParams) mLayout.getLayoutParams();
Run Code Online (Sandbox Code Playgroud)
E/AndroidRuntime(4066): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.name.project/com.name.project.Main}: java.lang.NullPointerException
xml用于布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center" >
Run Code Online (Sandbox Code Playgroud)
知道为什么会发生这种情况吗?