我正在开发一个小应用程序,列出Android设备上存在/安装的所有应用程序。但是当我试图运行代码时,我得到了以下错误。
安装错误:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
任何人都可以帮我解决这个错误。我在堆栈上阅读了所有类似的错误帖子,但它们都没有帮助。所以我也把我的源代码希望有人可以帮助我。
主要活动清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.ankitverma.energyharvest"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="info.ankitverma.energharvest.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="info.ankitverma.energharvest.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="Energy Harvest">
<uses-library
android:name="com.google.android.maps" />
<activity
android:name="info.ankitverma.energyharvest.MainActivity"
android:label="Energy Harvest"
android:theme="@style/AppBaseTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Goolge API Key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDOxEOjotMFhFPxhtea72ryXKDpwGQQESw"
/>
<meta-data android:name="com.google.android.gms.version"/>
</application>
</manifest>
主要活动Java文件:
package info.ankitverma.energyharvest;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final MapFragment mapFragment = (MapFragment)getFragmentManager().findFragmentById(R.id.map);
final MapWrapperLayout mapWrapperLayout = (MapWrapperLayout)findViewById(R.id.map_relative_layout);
final GoogleMap map = mapFragment.getMap();
// MapWrapperLayout initialization
// 39 - default marker height
// 20 - offset between the default InfoWindow bottom edge and it's content bottom edge
mapWrapperLayout.init(map, getPixelsFromDp(this, 39 + 20));
// We want to reuse the info window for all the markers,
// so let's create only one class member instance
this.infoWindow = (ViewGroup)getLayoutInflater().inflate(R.layout.info_window, null);
this.infoTitle = (TextView)infoWindow.findViewById(R.id.title);
this.infoSnippet = (TextView)infoWindow.findViewById(R.id.snippet);
this.infoButton = (Button)infoWindow.findViewById(R.id.button);
// Setting custom OnTouchListener which deals with the pressed state
// so it shows up
this.infoButtonListener = new OnInfoWindowElemTouchListener(infoButton,
getResources().getDrawable(R.drawable.dbh1),
getResources().getDrawable(R.drawable.dbh10))
{
@Override
protected void onClickConfirmed(View v, Marker marker) {
// Here we can perform some action triggered after clicking the button
Toast.makeText(MainActivity.this, marker.getTitle() + getResources().getDrawable(R.drawable.dbh10), Toast.LENGTH_SHORT).show();
}
};
this.infoButton.setOnTouchListener(infoButtonListener);
map.setInfoWindowAdapter(new InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
// Setting up the infoWindow with current's marker info
infoTitle.setText(marker.getTitle());
infoSnippet.setText(marker.getSnippet());
infoButtonListener.setMarker(marker);
// We must call this to set the current marker and infoWindow references
// to the MapWrapperLayout
mapWrapperLayout.setMarkerWithInfoWindow(marker, infoWindow);
return infoWindow;
}
});
LatLng IrvinePark = new LatLng(33.646091,-117.842737);
LatLng IrvineDBH = new LatLng(33.643197,-117.841996);
LatLng IrvineStudentCenter = new LatLng(33.64944,-117.842469);
LatLng IrvineParkingStructure1 = new LatLng(33.643152,-117.837608);
LatLng IrvineParkingStructure2 = new LatLng(33.647542,-117.837489);
LatLng IrvineFoodCourt1 = new LatLng(33.645939,-117.844325);
LatLng IrvineFoodCourt2 = new LatLng(33.645626,-117.840709);
LatLng IrvineTheater = new LatLng(33.649181,-117.840773);
LatLng IrvineLibrary1 = new LatLng(33.645751,-117.846739);
LatLng IrvineLibrary2 = new LatLng(33.647341,-117.84146);
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvinePark, 13));
map.addMarker(new MarkerOptions()
.title("Alrich Park")
.snippet("University of california Irvine")
.position(IrvinePark));
//
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvineDBH, 13));
map.addMarker(new MarkerOptions()
.title("DBH")
.snippet("University of california Irvine")
.position(IrvineDBH));
//
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvineStudentCenter, 13));
map.addMarker(new MarkerOptions()
.title("Student Center")
.snippet("University of california Irvine")
.position(IrvineStudentCenter));
//
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvineParkingStructure1, 13));
map.addMarker(new MarkerOptions()
.title("Anteater Parking Structure")
.snippet("University of california Irvine")
.position(IrvineParkingStructure1));
//
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvineFoodCourt1, 13));
map.addMarker(new MarkerOptions()
.title("BC Caverns Food Court")
.snippet("University of california Irvine")
.position(IrvineFoodCourt1));
//
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvineFoodCourt2, 13));
map.addMarker(new MarkerOptions()
.title("Phenoix Food Court")
.snippet("University of california Irvine")
.position(IrvineFoodCourt2));
//
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvineTheater, 13));
map.addMarker(new MarkerOptions()
.title("Irvine Barcaly Theater")
.snippet("University of california Irvine")
.position(IrvineTheater));
//
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvineLibrary1, 13));
map.addMarker(new MarkerOptions()
.title("Science Library")
.snippet("University of california Irvine")
.position(IrvineLibrary1));
//
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvineLibrary2, 13));
map.addMarker(new MarkerOptions()
.title("Between Langson and Gateway")
.snippet("University of california Irvine")
.position(IrvineLibrary2));
//
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(IrvineParkingStructure2, 13));
map.addMarker(new MarkerOptions()
.title("Social Sicence Parking Structure")
.snippet("University of california Irvine")
.position(IrvineParkingStructure2));
}
public static int getPixelsFromDp(Context context, float dp) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int)(dp * scale + 0.5f);
}
}
活动主要:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
答案 0 :(得分:0)
尝试移动
<permission
android:name="info.ankitverma.energharvest.permission.MAPS_RECEIVE"
android:protectionLevel="signature"
低于<uses-permission
代码
或删除&#34; gen&#34;文件夹,让它重新创建自己。