自定义OneSignal构建提供了包com.onesignal不存在

时间:2019-08-02 01:20:33

标签: android gradle dependencies onesignal

我无法在Qt Android应用程序Java文件中导入com.onesignal.OneSignal,出现错误:包com.onesignal不存在

  • 我已经使用these sources构建了自定义的OneSignal Android SDK库。
  • 我已将 onesignal-sources.jar 文件添加到 android / libs 目录中。
  • 我已经通过添加编译文件('libs / onesignal-sources.jar')和另外6个根据{{ 3}}

我想这足以使导入工作正常。

顺便说一句,如果我将OneSignal添加为远程二进制依赖项,则 compile'c​​om.onesignal:OneSignal:[3.9.1,3.99.99]'导入效果很好。

整个build.gradle:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }
    }
}

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:[26.0.0, 27.2.0]'
    compile 'com.android.support:customtabs:[26.0.0, 27.2.0]'
    compile 'com.android.support:cardview-v7:[26.0.0, 27.2.0]'
    compile 'com.google.android.gms:play-services-location:[10.2.1, 12.1.0]'
    compile 'com.google.android.gms:play-services-base:[10.2.1, 12.1.0]'
    compile 'com.google.firebase:firebase-messaging:[10.2.1, 12.1.0]'
    compile files('libs/onesignal-sources.jar')
    //compile 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
}

android {
    /*******************************************************
     * The following variables:
     * - androidBuildToolsVersion,
     * - androidCompileSdkVersion
     * - qt5AndroidDir - holds the path to qt android files
     *                   needed to build any Qt application
     *                   on Android.
     *
     * are defined in gradle.properties file. This file is
     * updated by QtCreator and androiddeployqt tools.
     * Changing them manually might break the compilation!
     *******************************************************/

    compileSdkVersion androidCompileSdkVersion.toInteger()

    buildToolsVersion androidBuildToolsVersion

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
            aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
            res.srcDirs = [qt5AndroidDir + '/res', 'res']
            resources.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
       }
    }

    lintOptions {
        abortOnError false
    }

    defaultConfig {
        applicationId "app id"
        manifestPlaceholders = [
          onesignal_app_id: "onesignal app id",
          onesignal_google_project_number: "REMOTE"
        ]
    }
}

0 个答案:

没有答案