【发布时间】:2015-01-23 15:05:21
【问题描述】:
问题:我正在开发内容展示应用。现在我想启用 GCM 推送通知应用程序,为此我从
下载了一个示例项目示例项目运行良好,通知按预期发送。
现在我将以下文件复制粘贴到我的项目中
1.清单文件
2.xml文件
3. 值文件
4. MainActivity 文件
我从之前复制的代码中更改了我需要的 Packagename,但它仍然无法正常工作。请指导我应该在哪一行更改项目的包名,我应该在哪里使用类包名以及我应该在哪里使用项目包名。
因为包名和子包名相同,所以报错。
Code:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<!-- Register Activity -->
<activity
android:name="com.androidhive.pushnotifications.RegisterActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Main Activity -->
<activity
android:name="com.androidhive.pushnotifications.MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name" >
</activity>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.androidhive.pushnotifications" />
</intent-filter>
</receiver>
<service android:name="com.androidhive.pushnotifications.GCMIntentService" />
</application>
作为 android 开发的新手,我无法弄清楚这段代码中的主包名称。
任何建议都会很棒!提前致谢
【问题讨论】:
-
您收到的确切错误是什么,您在哪里看到的?
标签: java android import package android-debug