1

大幅に変更したいくつかのオープン ソース コードに基づいたライブ壁紙があります。最後の項目として、Eclipse で右クリックしてパッケージ名を変更したところ、問題なく動作しました。壁紙は正しく機能します。設定メニューは正しく機能します。しかし、設定メニューの項目をクリックして別のアクティビティを起動しようとすると、次のようになります。

 10-10 16:16:56.215: E/AndroidRuntime(13825): FATAL EXCEPTION: main
 10-10 16:16:56.215: E/AndroidRuntime(13825): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.nightscapecreations.orionkeysfree/ffvideolivewallpaper.frankandrobot.com.extLinkNC}; have you declared this activity in your AndroidManifest.xml?

マニフェスト ファイルは次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.nightscapecreations.anim1"
    android:versionCode="1"
    android:versionName="0.9.0" >

    <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" />

    <!-- Tell the system this app requires OpenGL ES 2.0. -->
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />

    <uses-feature android:name="android.software.live_wallpaper" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name" >
        <service
            android:name="ffvideolivewallpaper.frankandrobot.com.VideoLiveWallpaper"
            android:label="@string/wallpaper"
            android:permission="android.permission.BIND_WALLPAPER" >
            <intent-filter>
                <action android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>

            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/wallpaper" />
        </service>

        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.VideoLiveWallpaper"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.VideoWallpaperSettings"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.About"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.License"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.SelectVideo"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>

        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.extLinkNC"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.extLinkZazzle"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.extLinkFacebook"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.extLinkGooglePlus"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
    </application>

</manifest>

例として、この変更前に動作することが確認された About アクティビティを次に示します。

package ffvideolivewallpaper.frankandrobot.com;

import android.app.Activity;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
import android.content.Intent;
import android.view.View;
import com.nightscapecreations.anim1.R;

public class About extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.about);
        TextView t = (TextView) findViewById(R.id.about_box);
        t.setMovementMethod(LinkMovementMethod.getInstance());
    }

    public void showLicense(View view) {
    startActivity(new Intent(About.this, License.class));
    }
}

ffvideolivewallpaper.frankandrobot.com は古いパッケージ名です。Eclipse は、パッケージ名の変更中にすべてのアクティビティの android:name にプレフィックスを追加しました。私が理解できないのは、これが正しくない場合、サービス名がまったく同じように修飾されているため、なぜ壁紙が機能するのですか?




編集

デュナミスは素晴らしいキャッチをしました。元の名前は ffvideolivewallpaper.frankandrobot.com でしたが、その後何度か名前が変更されています。そのような名前の 1 つが com.nightscapecreations.orionkeysfree でした。設定xmlファイルで完全に見逃していた古い名前への参照がまだあったようです。例:

<PreferenceCategory android:title="Links and Information" >
        <PreferenceScreen android:title="Visit Nightscape Creations"
            android:summary="See more live wallpapers, get free static wallpapers, and learn about NC by visiting us online." >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkNC"
                android:targetPackage="com.nightscapecreations.orionkeysfree" />
        </PreferenceScreen>

ただし、これはまだ機能しません。このファイルとマニフェスト ファイルの間で、完全修飾名と単純なドット表記「.extLinkFacebook」のすべての組み合わせを試しましたが、成功しませんでした。両方の名前が完全に修飾された状態で現在受け取っているエラーは次のとおりです。

10-11 08:19:43.176: E/AndroidRuntime(25204): FATAL EXCEPTION: main
10-11 08:19:43.176: E/AndroidRuntime(25204): android.content.ActivityNotFoundException: Unable to find explicit activity class {ffvideolivewallpaper.frankandrobot.com/ffvideolivewallpaper.frankandrobot.com.extLinkFacebook}; have you declared this activity in your AndroidManifest.xml?

参照用の設定ファイルは次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

    <PreferenceCategory android:title="Wallpaper Settings">
        <ffvideolivewallpaper.frankandrobot.com.PrefsSlider
            android:key="fps"
            android:title="Framerate"
            android:summary="Set the target framerate.  Lower framerates will decrease resource usage.  Requires wallpaper restart to take effect."
            android:layout_width="fill_parent"
            android:defaultValue="30"
            android:orientation="vertical" />

<!--        <ListPreference -->
<!--                android:enabled="true" -->
<!--                android:key="resolution" -->
<!--                android:title="Resolution" -->
<!--                android:summary="Ultra resolution may decrease framerate.  Only recommended for high end devices." -->
<!--                android:entries="@array/prefs_resolutionEntries" -->
<!--                android:entryValues="@array/prefs_resolutionValues" -->
<!--                android:defaultValue="512" /> -->

<!--        <ListPreference -->
<!--                android:enabled="true" -->
<!--                android:key="frameTonality" -->
<!--                android:title="Filters" -->
<!--                android:summary="Various effects and filters can be applied to the animation" -->
<!--                android:entries="@array/prefs_tonalityEntries" -->
<!--                android:entryValues="@array/prefs_tonalityValues" -->
<!--                android:defaultValue="1" /> -->
    </PreferenceCategory>



    <PreferenceCategory android:title="Links and Information" >
        <PreferenceScreen android:title="Visit Nightscape Creations"
            android:summary="See more live wallpapers, get free static wallpapers, and learn about NC by visiting us online." >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkNC"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>

        <PreferenceScreen
            android:title="@string/prefsProductsHeading"
            android:summary="@string/prefsProductsSummary" >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkZazzle"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>

        <PreferenceScreen android:title="Like on Facebook" >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkFacebook"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>

        <PreferenceScreen android:title="Like on Google+" >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkGooglePlus"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>
    </PreferenceCategory>



    <PreferenceCategory android:title="About" >
        <PreferenceScreen android:title="About" >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.About"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>
    </PreferenceCategory>

</PreferenceScreen>
4

1 に答える 1

0

報奨金を追加した直後に、この問題の回避策を見つけました。ただし、元の問題が何であったかはまだわかりません。

これを解決するために、マニフェストの名前と一致するように、すべてのコードを含む ffvideolivewallpaper.frankandrobot.com パッケージの名前を変更しました。「com_nightscapecreations_anim1」へのネイティブ呼び出しですべての「ffvideolivewallpaper_frankandrobot_com」参照を変更するには、video.c ファイルを更新する必要があったため、これを行うのをためらっていました。バックアップ コピー。ただし、今日それを行った後、アプリを検索/置換して他のすべての参照を見つけたところ、機能させることができました。

ただし、上記の質問に対する答えを現状のまま知りたいと思います。検索/置換に煩わされるのではなく、メインのパッケージ名をそのままにしておくことができれば、将来、このベースから新しいアプリを作成するのがはるかに簡単になります. ただし、誰も知らない場合は、これを答えとしてマークします。

于 2013-10-15T13:51:27.787 に答える