您好我试图对代码进行采样,我收到了这个错误,我在下面发布了这个错误。我读到了它,当我的一个活动未在android清单中声明时,似乎是一个错误,但我确实将它们全部放在那里。
[weakSelf performSelectorInBackground:@selector(googleMapView) withObject:nil];
googleMapView{
[mapView animateToZoom:15];
int k=0;
@try {
GMSMutablePath *path = [GMSMutablePath path];
for(DRMapView * object in self.mapViewDataArray)
{
mMapViewObj=object;
GMSMarker * markersLocal = [[GMSMarker alloc] init];
pinImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,40+20*isiphone6Plus()+20*isiphone6(),60)];
markersLocal.position = CLLocationCoordinate2DMake(mMapViewObj.mLatitude, mMapViewObj.mLongitude);
[path addCoordinate: markersLocal.position];
view = [[UIView alloc] initWithFrame:CGRectMake(0,0,40+20*isiphone6Plus()+20*isiphone6(),60)];
view.backgroundColor=[UIColor blackColor];
pinImageView.contentMode = UIViewContentModeScaleAspectFit;
NSString * imageWithPercent;
label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 12.5, 12.5)];
if ([mMapViewObj.mGenderRatio isEqualToString:@""])
{
label.text =@"0";
imageWithPercent =[NSString stringWithFormat:MAP_NO_ONE];
pinImageView.image = [UIImage imageNamed:imageWithPercent];
}
else
{
// NSString *genderRatio =[NSString stringWithFormat:@"%@",[DrinkrCommon valueOrNil:[[dict objectForKey:kGenderRatio] objectForKey:kMale]]];
label.text =mMapViewObj.mTotalMembers;
int percentage = [mMapViewObj.mMaleFemaleRatio intValue];
if (percentage >= 80) {
imageWithPercent =[NSString stringWithFormat:@"map80"];
//NSLog(@"80====>>> %d",percentage);
}
else if (percentage >= 60) {
// NSLog(@"60====>>> %d",percentage);
imageWithPercent =[NSString stringWithFormat:@"map60"];
}
else if (percentage == 50) {
// NSLog(@"50====>>> %d",percentage);
imageWithPercent =[NSString stringWithFormat:@"map50"];
}
else if (percentage >= 40) {
// NSLog(@"40====>>> %d",percentage);
imageWithPercent =[NSString stringWithFormat:@"map40"];
}
else if (percentage >= 20) {
// NSLog(@"20====>>> %d",percentage);
imageWithPercent =[NSString stringWithFormat:@"map20"];
}
else if (percentage <= 20) {
// NSLog(@"<20====>>> %d",percentage);
imageWithPercent =[NSString stringWithFormat:@"map100"];
}
pinImageView.image = [UIImage imageNamed:imageWithPercent];
}
pinImageView.contentMode = UIViewContentModeScaleAspectFit;
[label setTextColor:[UIColor whiteColor]];
[label setBackgroundColor:[UIColor blackColor]];
[label sizeToFit];
label.layer.cornerRadius=label.frame.size.height / 2;
label.layer.masksToBounds = YES;
label.adjustsFontSizeToFitWidth=YES;
label.center=pinImageView.center;
view.center=pinImageView.center;
view.backgroundColor=[UIColor clearColor];
[view addSubview:pinImageView];
[view addSubview:label];
UIImage * markerIcon = [self imageFromView:view];
markersLocal.userData=[NSNumber numberWithInt:k+1];
markerView = [[UIImageView alloc] initWithImage:markerIcon];
markerView.tintColor = [UIColor blackColor];
markersLocal.iconView = markerView;
// markers.map = mapView;
marker=markersLocal;
// marker=m/MapViewObj.viewMarker;
marker.map=mapView;
k++;
}
GMSCoordinateBounds * bounds = [[GMSCoordinateBounds alloc] initWithPath:path];
[mapView animateWithCameraUpdate:[GMSCameraUpdate fitBounds:bounds withPadding:20.0f]];
}
@catch (NSException *exception) {
}
@finally {
}
}
这是我的Manifest xml文件
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.schwarzerritter.remotecontroll/com.example.schwarzerritter.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.schwarzerritter.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/base.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.schwarzerritter.remotecontroll-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
答案 0 :(得分:1)
更改活动代码
中MainActivity的 PackageName<activity
android:name="com.example.schwarzerritter.remotecontroll.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>