我正在尝试更新我的安卓应用,以使用从此处下载的适用于安卓的 Azure 移动应用 SDK 的 3.3 版。
https://github.com/Azure/azure-mobile-apps-android-client
为了消除复杂性,我根据微软的文档创建了一个新项目
https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-android-get-started-users
我将.jar文件放在项目的 libs 目录中。 当我尝试运行项目时,我收到无法找到类 .authentication 的显式活动类错误。自定义选项卡中间活动。
然后,我尝试以多种不同的方式在我的清单中声明此活动,但仍然收到此错误。
然后我下载了主文件并尝试将其导入 eclipse 并将其设置为库,但遇到了同样的错误。 主文件的清单中存在缺失值。
我应该怎么做?
我的清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pleasework"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".authentication.RedirectUrlActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https://myservice.azure-mobile.net/"
android:host="easyauth.callback"/>
</intent-filter>
</activity>
<activity android:name="com.example.pleasework.com.microsoft.mobileservices.authentication.CustomTabsIntermediateActivity" android:exported="true">
</activity>
</application>
</manifest>
我已经尝试过有和没有最终活动声明,并且还尝试了各种排列 com.microsoft.mobileservices.authentication.CustomTabsIntermediateActivity
无论我的清单中有什么值,我仍然会收到错误
我意识到建议的解决方案是迁移到 android studio,但我有一些应用程序使用此流程,现在不想迁移所有内容。
根据您的AndroidManifest.xml
内容,根据我的经验,我认为问题是由属于包com.microsoft.windowsazure.mobileservices
的.authentication.RedirectUrlActivity
活动类引起的,而不是您定义的包com.example.pleasework
。所以请不要在这里使用短类名。
请尝试替换AndroidManifest.xml
文件中的以下内容
<activity android:name=".authentication.RedirectUrlActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https://myservice.azure-mobile.net/"
android:host="easyauth.callback"/>
</intent-filter>
</activity>
<activity android:name="com.example.pleasework.com.microsoft.mobileservices.authentication.CustomTabsIntermediateActivity" android:exported="true">
</activity>
用正确的一个。
<activity android:name="com.microsoft.windowsazure.mobileservices.authentication.RedirectUrlActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="{url_scheme_of_your_app}"
android:host="easyauth.callback"/>
</intent-filter>
</activity>