gpt4 book ai didi

android - AltBeacon : BeaconConsumer in Service Not Working

转载 作者:行者123 更新时间:2023-11-30 02:08:26 25 4
gpt4 key购买 nike

在这个主题中 Beacons not detected in Android service但是当我把代码放在 list 中时

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ubiquitous.beaconone.tablet"
android:versionCode="3"
android:versionName="2.0" >

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

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

<application
android:icon="@drawable/logo"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Activities.MainActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:taskAffinity="">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activities.ScanningActivity"/>

<service
android:name="org.altbeacon.beacon.service.BeaconService"
android:enabled="true"
android:exported="true"
android:isolatedProcess="false"></service>
<service
android:name="org.altbeacon.beacon.BeaconIntentProcessor"
android:enabled="true"></service>

</application>

我遇到了一个错误:

错误:(48, 13) 属性服务#org.altbeacon.beacon.service.BeaconService@exported value=(true) from AndroidManifest.xml:48:13

错误:(48, 13) 任务“:app:processDebugManifest”执行失败。

Manifest merger failed : Attribute service#org.altbeacon.beacon.service.BeaconService@exported value=(true) from AndroidManifest.xml:48:13 is also present at org.altbeacon:android-beacon-library:2.1.4:27:13 value=(false) Suggestion: add 'tools:replace="android:exported"' to element at AndroidManifest.xml:45:9 to override

最佳答案

使用 Android Beacon Library 时,您通常不希望将其服务声明放在您的 list 中,因为库本身包含自己的 AndroidManifest.xml 文件并使用称为 list 合并的过程(使用 Android Studio 时自动)将库中的条目合并到您应用程序的 list 中.

此过程将复制此处显示的 list 条目:https://github.com/AltBeacon/android-beacon-library/blob/master/src/main/AndroidManifest.xml

在问题中显示的代码中,冲突条目已放入应用程序的 list 中,因此合并失败。这就是错误信息的意思。

冲突的确切来源是属性 android:exported="true" .该属性的值在最新版本的库中已更改为 false。

您可以通过多种方式解决此问题。仅选择以下一个:

  1. 从 list 中删除这两个服务条目。合并将自动添加适当的条目。

  2. 更改 android:exported="true"android:exported="false"

  3. 添加tools:replace="android:exported"android:exported="true"之后

  4. 关闭 list 合并并自行输入所有条目。您还需要复制 StartupBroadcastReceiver如果您想自动启动,请输入。

在这里查看相关讨论:http://altbeacon.github.io/android-beacon-library/alternate-configuration.html

关于android - AltBeacon : BeaconConsumer in Service Not Working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30431906/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com