【问题标题】:Manifest activity no launched清单活动未启动
【发布时间】:2021-08-22 06:40:05
【问题描述】:

当我将 Manifest 文件和具有设置pendingIntent 的函数的控制器放在同一目录中以显示manifest 文件中定义的对话框时,可以成功触发对话框。但是在我将它们分开到不同的目录后,对话框不再被触发。我已经更新了清单文件中对话框的路径,但我不知道为什么新的文件夹结构不再起作用。清单文件是否应该与对话活动类文件在同一目录中?

清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=""
package=""
>

<application>
  <activity
      android:name="path to dialog"
      android:excludeFromRecents="true"
      android:exported="false"
      android:finishOnTaskLaunch="true"
      android:launchMode="singleTask"
      android:permission=""
      android:taskAffinity=""
      android:theme=""
      />
</application>
</manifest>
Here is the original folder structure, which is working:

--showdialog
    --BUCK 
    --AndroidManifest.xml
    --Dialog.class
    --Controller.class


Here is the new folder structure, no longer working:
--showdialog
    --AndroidManifest.xml
    --controller
      --BUCK
      --Controller.class
    --dialog
      --BUCK
      --Dialog.class

【问题讨论】:

  • 我不明白。问题是什么?
  • 更改文件夹结构后,我在清单文件中更新了对话框的路径,但不知道为什么新的文件夹结构不再起作用(更改后无法触发对话框) .
  • 如果您单击 AndroidManifest 中提到的路径,是否会将您带到实际文件?
  • 您是否真的将已编译的 .class 文件放入您的文件夹中?你是如何启动这个的?

标签: android android-manifest


【解决方案1】:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=""
package="com.example.app"
>

<application>
  <activity
      android:name=".MainDialog"
      android:excludeFromRecents="true"
      android:exported="false"
      android:finishOnTaskLaunch="true"
      android:launchMode="singleTask"
      android:permission=""
      android:taskAffinity=""
      android:theme=""
      />
</application>
</manifest>

确保MainDialog 遵循com.example.app 的java 类路径。

即;

MainDialog 的包名应该类似于,

package com.example.app;

public class MainDialog {

}

您在android:name 中指定的任何内容都位于指定的包名称(“com.example.app”)之后。

告诉我们进展如何。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-02
    • 1970-01-01
    相关资源
    最近更新 更多