close
參考資料:https://medium.com/@authmane512/how-to-build-an-apk-from-command-line-without-ide-7260e1e22676
最基本程式HelloWorld
(1) AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.helloworld" android:versionCode="1" android:versionName="1.0" > <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
(2) MainActivity.java
package com.helloworld; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
(3) res/layout/activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> </RelativeLayout>
(4)res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">Hello World</string> <string name="hello_world">Hello world!</string> </resources>
Download Jar of Beans 4.8 - Giả lập Android trên PC -taimienphi.vn
Andy 47.0.1091 Download for Windows / FileHorse.com
全站熱搜