Android App Installation Instructions

安装配置Android开发环境
本文详细介绍了如何安装和配置Android开发环境,包括设置Java JDK、下载Android ADT Bundle、配置环境变量、安装Google USB驱动、设置Android设备进行调试等步骤,并提供了安装Android应用及查看日志的方法。

Download and Install Android SDK

1.      Installjava JDK from here

2.      Download the Android ADT bundle from here

3.      Extractthe zip file to c:\Android

4.      Soyou will have a directory structure as follows

C:\Android\adt-bundle-windows\sdk

C:\Android\adt-bundle-windows\eclipse

5.      Addc:\Android\adt-bundle-windows\sdk\platform-tools to PATH environment variable

6.      Addc:\Android\adt-bundle-windows\sdk\ tools to PATH environment variable

7.      Downloadand install latest Google USB Driver for windows here

Setup Android device

1.      Onandroid device, open Settings application

2.      Connectandroid to the PC using USB cable

3.      Navigateto Developer options

4.      Checkthe “Enable USB debugging” option to enable USB debugging

5.      Opencommand prompt (cmd.exe) and type “adb devices” you will see an outputsomething like below

List of devicesattached

c1607c40ebbb54f   device

6.      Thereare few devices that require little more than just “USB Debugging” enabledespecially the phones. Follow below steps if you don’t see your device listedand you are using a phone

a.     Swipe your figure from top of the phone

b.     This opens a popup window for USB options

c.      Try USB option such as “Use as Mass storage” andtry “adb devices” on command line.

d.     Try other USB options until you find the optionthat works

7.      Ifnone of the above works try “google.com” for a solution to your connectivityissues 

Download Android builds

1.      Downloadlatest build from http://xx.xx.xx.xxx:8080/tms/builds/android/x.x.xx/TMS_Android.zipwhere x.x.xx stands for build version number (1.0.59)

2.      TMS_Android.zipfile contains following files

·        ReleaseNotes.txt – Build release notes

·        xxx-debug.apk – Debug build

·        xxx-release.apk – Release build

·        xxx-vpn-debug.apk – Vpn only debugbuild

·        xxx-vpn-release.apk – Vpn onlyrelease build

Install Android build

1.      Opencommand prompt (cmd.exe)

2.      Checkif your device is connected with “adb devices” and verify your device is listed

3.      Type“adb install xxx-debug.apk”

4.      Ifyou already installed the app, you need to uninstall it first using “adbuninstall com.xxx.android.tms” command or settings application on thedevice

View Log Outputs

There are many ways you can view Android Logcat outputs usethe one you are most comfortable with. Below are some popular ways of gettingandroid logs

-         From command line “adb logcat”

-         Run ddms tool and select your device

-         Run monitor tool

-         To view the logs on device, install “CatLog”application using “Google play” and run it.

-         Use eclipse

You can create filter to view only logs from xxx application.


If you are using DDMS/Monitor/Eclipse,

1.      Clickon “+” button on the left pane

2.      Onthe “Logcat Message Filter Settings” dialog provide a name for your filter

3.      Type“com.xxx.android.tms” on “by Application Name” field

4.      Click“OK” to create a new filter

5.      Nowyou can select the filter on the left pane and view only xxx log messages.


Catlog application and “adb logcat” also allow you to setupfilters you can explore them if you want. I would recommend using one of DDMS/Monitor/Eclipse.

Android交通app的制作涉及到多个方面,包括地图、定位、路线规划、公交路线等。因此要实现一个完整的交通app需要涉及很多的代码和知识。以下是一个简单的Android交通app的源码: 1. 在开发环境中创建一个新的Android项目。 2. 在app的xml文件中添加地图控件: <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" /> 3. 在MainActivity.java中添加以下代码来设置地图: private GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setUpMapIfNeeded(); } private void setUpMapIfNeeded() { if (mMap == null) { SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; } }); } } 4. 添加定位代码: private LocationManager locationManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ... locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { return; } Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (location != null) { LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14)); } } 5. 添加路线规划代码: private void getDirections(LatLng origin, LatLng dest) { String url = "https://maps.googleapis.com/maps/api/directions/json?origin=" + origin.latitude + "," + origin.longitude + "&destination=" + dest.latitude + "," + dest.longitude + "&mode=driving&key=YOUR_API_KEY"; JsonObjectRequest request = new JsonObjectRequest(url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { JSONArray routes = response.getJSONArray("routes"); JSONObject route = routes.getJSONObject(0); JSONArray legs = route.getJSONArray("legs"); JSONObject leg = legs.getJSONObject(0); JSONArray steps = leg.getJSONArray("steps"); for (int i = 0; i < steps.length(); i++) { JSONObject step = steps.getJSONObject(i); String htmlInstructions = step.getString("html_instructions"); mMap.addMarker(new MarkerOptions().position(new LatLng(step.getJSONObject("start_location").getDouble("lat"), step.getJSONObject("start_location").getDouble("lng"))).title(htmlInstructions)).showInfoWindow(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { error.printStackTrace(); } }); Volley.newRequestQueue(this).add(request); } 6. 添加公交路线代码: private void getBusDirections(String origin, String dest) { String url = "https://maps.googleapis.com/maps/api/directions/json?origin=" + origin + "&destination=" + dest + "&mode=transit&key=YOUR_API_KEY"; JsonObjectRequest request = new JsonObjectRequest(url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { JSONArray routes = response.getJSONArray("routes"); JSONObject route = routes.getJSONObject(0); JSONArray legs = route.getJSONArray("legs"); JSONObject leg = legs.getJSONObject(0); JSONArray steps = leg.getJSONArray("steps"); for (int i = 0; i < steps.length(); i++) { JSONObject step = steps.getJSONObject(i); String htmlInstructions = step.getString("html_instructions"); mMap.addMarker(new MarkerOptions().position(new LatLng(step.getJSONObject("start_location").getDouble("lat"), step.getJSONObject("start_location").getDouble("lng"))).title(htmlInstructions)).showInfoWindow(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { error.printStackTrace(); } }); Volley.newRequestQueue(this).add(request); } 以上是简单Android交通app的源码示例,但是具体App的实现还需要更多的代码,这里仅做为参考示例。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值