【问题标题】:Android Push Notification with Azure Notification Hub使用 Azure 通知中心的 Android 推送通知
【发布时间】:2016-05-28 06:40:33
【问题描述】:

我正在尝试使用 Azure 通知中心将推送通知实现到我的 Android 应用程序中。我遵循了here 的说明,但是当我到达Adding Azure Notification Hubs libraries 的步骤时,我被卡住了。首先,他们提供的链接上的“文件”选项卡上没有名为notification-hubs-0.4.jar 的文件,所以我假设我想要的是notification-hubs-android-sdk-0.4.jar。所以我下载了它并将它包含在我的 assets\libs 文件夹中。然后我按照说明将所需的行添加到我的 build.gradle 文件中,但我不断收到错误提示

任务 ':app:processDebugResources' Process 'command 'C:\pathtothefile...\aapt.exe'' 以非零退出值 1 结束执行失败。

我的 build.gradle 文件看起来像这样...

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.myapplicationid.android"
        minSdkVersion 10
        targetSdkVersion 23
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
        }
    }
}

dependencies {
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'
    compile files('src/main/assets/libs/android-maps-extensions.jar')
    compile files('src/main/assets/libs/android-viewbadger.jar')
}

repositories {
    maven {
        url "http://dl.bintray.com/microsoftazuremobile/SDK"
    }
}

我在这里做错了吗?有人可以指出我的错误吗?

【问题讨论】:

    标签: android azure azure-mobile-services azure-notificationhub


    【解决方案1】:

    我们也将正确更新文档,但在我们这样做时,将 compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar' 添加到依赖项中,看看是否有效。

    【讨论】:

    • 实际上,最终的工作是我升级了 Android Studio 中的所有内容并重新启动。然后项目将成功构建。现在我在运行时遇到错误,尽管在空对象引用上显示“尝试调用虚拟方法 'boolean com.google.android.gms.common.ConnectionResult.isSuccess()'”
    • 您是否曾经解决过这个问题?我们尝试按照教程进行复制,但效果很好……你有完整的错误跟踪吗?
    • @我浏览并更新了我在 Android Studio 中能想到的所有内容,然后重新启动错误就消失了。一定与旧的 SDK 版本或其他东西有关。
    • 很高兴听到事情成功了!如果您遇到任何其他问题,请告诉我。
    • “@aar”是做什么的?我为身份验证包做了这个,它神奇地起作用了?
    猜你喜欢
    • 2021-08-03
    • 2019-08-25
    • 1970-01-01
    • 2018-04-28
    • 1970-01-01
    • 2017-06-05
    • 1970-01-01
    • 2019-06-18
    • 1970-01-01
    相关资源
    最近更新 更多