缺少AndroidManifest.xml中的意图声明?

时间:2018-06-02 08:52:03

标签: android delphi

我正在尝试这个,但是从调试器获取错误:“无法找到显式活动类...你是否在AndroidManifest.xml中声明了这个活动?我只想在应用程序终止时再次打开应用程序。我必须添加什么东西要显示文件或我在哪里做错?我看到类似的,它有相同的清单文件。

代码段:

procedure OpenApp(PackageName, AppName : JString);
var
  Intent : JIntent;
  NativeComponent : JComponentName;
begin
  Intent := TJIntent.Create;
  Intent.setAction(TJIntent.JavaClass.ACTION_MAIN);
  Intent.addCategory(TJIntent.JavaClass.CATEGORY_LAUNCHER);
  NativeComponent := TJComponentName.JavaClass.init(PackageName, AppName);
  Intent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK or TJIntent.JavaClass.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
  Intent.setComponent(NativeComponent);
  SharedActivity.startActivity(Intent);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  OpenApp(SharedActivityContext.getPackageName, StringToJString('CrypTo!')); 
end;

清单文件:

<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="cz.CrypToX"
        android:versionCode="1"
        android:versionName="1.0.0"
        android:installLocation="auto">

    <!-- This is the platform API where NativeActivity was introduced. -->
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <uses-feature android:glEsVersion="0x00020000" android:required="True"/>
    <application android:persistent="true" 
        android:restoreAnyVersion="False" 
        android:label="CrypTo!" 
        android:debuggable="True" 
        android:largeHeap="False"
        android:icon="@drawable/ic_launcher"
        android:theme="@style/AppTheme"
        android:hardwareAccelerated="true">

        <!-- Our activity is a subclass of the built-in NativeActivity framework class.
             This will take care of integrating with our NDK code. -->
        <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
                android:label="CrypTo!"
                android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
                android:launchMode="singleTask">
            <!-- Tell NativeActivity the name of our .so -->
            <meta-data android:name="android.app.lib_name"
                android:value="CrypToXHost" />
            <intent-filter>  
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter> 
        </activity>        
        <receiver android:name="com.embarcadero.rtl.notifications.NotificationAlarm" />
    </application>
</manifest>
<!-- END_INCLUDE(manifest) -->

0 个答案:

没有答案