标签:新建 version string oid over odi jce xmlns this
我们在建立完后经常会报如下的错误:
这里首先你需要查看你的SDK的版本,首先进行更改版本,我这里更改如下:
注释掉junit:
更改:
allprojects {
repositories {
// jcenter()
maven { url 'http://repo1.maven.org/maven2' }
}
}
然后重新引入下相关的gradle即可
Generate Layout File勾选的话会默认创一个默认的布局,launcher Activity只的是把当前的类当做主活动
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button 1"
/>
</LinearLayout>
然后在主类窗口中加载这个按钮:
package com.example.activitytest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class FirstActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.first_layout);
}
}
修改AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.activitytest">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".FirstActivity"
android:label="this is first"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
标签:新建 version string oid over odi jce xmlns this
原文地址:https://www.cnblogs.com/charlypage/p/9961141.html