我从去年的 Google IO 分叉了 IOSchedule 应用程序。我想确保我可以获得一个 API 密钥,这意味着我需要对应用程序进行签名,并且它与内容提供者没有冲突,这意味着我需要重构。但是,每次我尝试使用 Android Tools > Refactor Package Name 时,都会遇到问题,即修改内容提供程序。
这是内容提供者的标签:
<provider
android:name="com.google.android.apps.iosched.provider.ScheduleProvider"
android:authorities="com.google.android.apps.iosched"
android:label="@string/app_name"
android:syncable="true"
android:writePermission="com.google.android.apps.iosched.permission.WRITE_SCHEDULE" />
我一直在尝试将其更改为以下内容:
<provider
android:name="com.google.android.apps.iosched.provider.ScheduleProvider"
android:authorities="org.mrkaiser.android.apps.iosched"
android:label="@string/app_name"
android:syncable="true"
android:writePermission="com.google.android.apps.iosched.permission.WRITE_SCHEDULE" />
但是在运行时我收到以下错误:
04-22 21:29:13.818: E/AndroidRuntime(12329): java.lang.NullPointerException
04-22 21:29:13.818: E/AndroidRuntime(12329): at com.google.android.apps.iosched.ui.MyScheduleFragment.onLoadFinished(MyScheduleFragment.java:175)
04-22 21:29:13.818: E/AndroidRuntime(12329): at com.google.android.apps.iosched.ui.MyScheduleFragment.onLoadFinished(MyScheduleFragment.java:1)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.app.LoaderManagerImpl$LoaderInfo.callOnLoadFinished(LoaderManager.java:424)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(LoaderManager.java:392)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.content.Loader.deliverResult(Loader.java:103)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.content.CursorLoader.deliverResult(CursorLoader.java:81)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.content.CursorLoader.deliverResult(CursorLoader.java:35)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.content.AsyncTaskLoader.dispatchOnLoadComplete(AsyncTaskLoader.java:221)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.content.AsyncTaskLoader$LoadTask.onPostExecute(AsyncTaskLoader.java:61)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.content.ModernAsyncTask.finish(ModernAsyncTask.java:461)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.content.ModernAsyncTask.access$500(ModernAsyncTask.java:47)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.support.v4.content.ModernAsyncTask$InternalHandler.handleMessage(ModernAsyncTask.java:474)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.os.Handler.dispatchMessage(Handler.java:99)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.os.Looper.loop(Looper.java:137)
04-22 21:29:13.818: E/AndroidRuntime(12329): at android.app.ActivityThread.main(ActivityThread.java:5226)
04-22 21:29:13.818: E/AndroidRuntime(12329): at java.lang.reflect.Method.invokeNative(Native Method)
04-22 21:29:13.818: E/AndroidRuntime(12329): at java.lang.reflect.Method.invoke(Method.java:511)
04-22 21:29:13.818: E/AndroidRuntime(12329): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
04-22 21:29:13.818: E/AndroidRuntime(12329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
04-22 21:29:13.818: E/AndroidRuntime(12329): at dalvik.system.NativeStart.main(Native Method)
我不确定我做错了什么。如果我尝试重构包 R 与一些 xml 文件不同步并且我无法恢复。