java.lang.ClassNotFoundException:没有';“找不到类”;com.google.android.gms.maps.SupportMapFragment“;在路上
请帮我解决java.lang.ClassNotFoundException:没有';“找不到类”;com.google.android.gms.maps.SupportMapFragment“;在路上,android,google-cloud-messaging,Android,Google Cloud Messaging,请帮我解决 android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:weightSum="100" > <include android:id="@+id/headerLayout" android:layout_width="fill_parent
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="100" >
<include
android:id="@+id/headerLayout"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="10"
layout="@layout/header" />
<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="90"
android:background="@drawable/background_login"
android:gravity="center"
android:orientation="vertical" >
<!-- <Button
android:id="@+id/btn_phone_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/five_dp"
android:layout_marginLeft="@dimen/twenty_dp"
android:layout_marginRight="@dimen/twenty_dp"
android:background="@drawable/rounded_edittext"
android:focusable="false"
android:hint=""
android:padding="@dimen/seven_dp" />
-->
<LinearLayout
android:id="@+id/content1Layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/twenty_dp"
android:layout_marginRight="@dimen/twenty_dp"
android:gravity="center" >
<!-- <EditText
android:id="@+id/edtCountryCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/five_dp"
android:background="@drawable/rounded_edittext"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="number"
android:padding="@dimen/seven_dp" />
-->
<Button
android:id="@+id/btn_phone_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/five_dp"
android:background="@drawable/rounded_edittext"
android:focusable="false"
android:hint="Code"
android:focusableInTouchMode="false"
android:inputType="number"
android:padding="@dimen/seven_dp" />
<EditText
android:id="@+id/et_no_register"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/rounded_edittext"
android:hint="@string/mobile_no"
android:inputType="phone"
android:maxLength="10"
android:padding="@dimen/seven_dp" />
</LinearLayout>
<EditText
android:id="@+id/et_email_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/twenty_dp"
android:layout_marginRight="@dimen/twenty_dp"
android:layout_marginTop="@dimen/five_dp"
android:background="@drawable/rounded_edittext"
android:hint="Email Address"
android:padding="@dimen/seven_dp" >
</EditText>
<Button
android:id="@+id/btn_register"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/twenty_dp"
android:layout_marginRight="@dimen/twenty_dp"
android:layout_marginTop="@dimen/ten_dp"
android:background="@drawable/continue_icon"
android:text="@string/btncontinue"
android:textColor="@color/white" />
</LinearLayout>
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="1dp"
android:layout_height="1dp" />
</LinearLayout>
错误发生在:
class RegisteGCMId extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
try {
GoogleCloudMessaging gcm = GoogleCloudMessaging
.getInstance(RegisterActivity.this);
regid = gcm.register(Constant.SENDER_ID);
final SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(RegisterActivity.this);
Editor editor = prefs.edit();
editor.putString(Pref.GCM_ID, regid);
editor.commit();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
class RegisteGCMId扩展了异步任务{
@凌驾
受保护的Void doInBackground(Void…参数){
试一试{
GoogleCloudMessaging gcm=GoogleCloudMessaging
.getInstance(RegisterActivity.this);
regid=gcm.register(常量发送方ID);
最终SharedReferences prefs=首选项管理器
.GetDefaultSharedReferences(RegisterActivity.this);
编辑器编辑器=prefs.edit();
编辑器.putString(Pref.GCM_ID,regid);
commit();
}捕获(IOE异常){
e、 printStackTrace();
}
返回null;
}
在为API 9编译时,您必须使用一个支持映射片段,而不是映射片段。请使用此片段替换映射片段
<fragment
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
我想您正在使用GCM的map fragment,这不是必需的意思?您能解释一下吗?不,我也尝试过com.google.android.gms.maps.SupportMapFragment,但我遇到了相同的错误想要实现google map或GCM吗?不,我也尝试过com.google.android.gms.maps.SupportMapFragment,但我遇到了相同的错误
class RegisteGCMId extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
try {
GoogleCloudMessaging gcm = GoogleCloudMessaging
.getInstance(RegisterActivity.this);
regid = gcm.register(Constant.SENDER_ID);
final SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(RegisterActivity.this);
Editor editor = prefs.edit();
editor.putString(Pref.GCM_ID, regid);
editor.commit();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
<fragment
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.SupportMapFragment" />