1

我想为 Nativescript 使用 AppsFlyer 插件:https ://github.com/AppsFlyerSDK/nativescript-plugin-appsflyer

但是当我想构建项目(对于Android)时,我有这个错误:

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_F0F1F2F3DebugApkCopy'.
   > Could not find :af-android-sdk-4.8.3:.
     Required by:
         project :app

有人可以帮我吗?

4

1 回答 1

0

我有:

tns --version //3.2.1
npm -v        //5.6.0
node -v       //7.2.1 

脚步:

$ tns create HelloWorld --template nativescript-template-tutorial
$ cd HelloWorld/

$ tns plugin add nativescript-plugin-appsflyer
+ nativescript-plugin-appsflyer@1.0.10
added 1 package in 5.066s
Successfully installed plugin nativescript-plugin-appsflyer.

打开main-page.js并更改为以下内容:

exports.pageLoaded = function() {

var appsFlyer = require("nativescript-plugin-appsflyer");

console.log("FESS :: call initSdk ... ");

        var options = {
            devKey:  'WdpTVAcYwmxsaQ4WeTspmh',
            appId: "975313579",
            isDebug: true
        };

        appsFlyer.initSdk(options).then(function(result) {
            alert("initSdkResponse: " +  result.status);
        }, function(err) {
            console.log("trackEvent :: results  ... " +  JSON.stringify(err));            
            alert("initSdkResponse: " +  JSON.stringify(err));
        });
};

运行后:

$ tns run android

输出:

     Searching for devices...
Copying template files...
  ◜ Installing tns-androidInstalling  tns-android
+ tns-android@3.2.0
added 1 package in 2.689s
+ babel-traverse@6.26.0
added 24 packages in 5.856s
+ babel-types@6.26.0
updated 1 package in 1.792s
+ babylon@6.18.0
updated 1 package in 1.785s
+ lazy@1.0.11
added 1 package in 2.613s
Project successfully created.
Preparing project...
Successfully prepared plugin nativescript-plugin-appsflyer for android.
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Gradle build...

:config phase:  createDefaultIncludeFiles

:config phase:  addAarDependencies
        +adding dependency: /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/libs/aar/widgets-release.aar
        +adding dependency: /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/libs/aar/af-android-sdk-4.8.3.aar
Project successfully prepared (Android)
Building project...
Gradle build...

:config phase:  createDefaultIncludeFiles
        +found plugins: nativescript-plugin-appsflyer
Renaming plugin directory to flavor name: /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/src/nativescript-plugin-appsflyer -> /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/src/F0
        +found plugins: tns-core-modules-widgets
         + creating include.gradle file for /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/configurations/tns-core-modules-widgets
Renaming plugin directory to flavor name: /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/src/tns-core-modules-widgets -> /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/src/F1

:config phase:  createPluginsConfigFile
         Creating product flavors include.gradle file in /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/configurations folder...

:config phase:  pluginExtend
        +applying configuration from: /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/configurations/nativescript-plugin-appsflyer/include.gradle
        +applying configuration from: /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/configurations/include.gradle
        +applying configuration from: /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  addAarDependencies
        +adding dependency: /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/libs/aar/widgets-release.aar
        +adding dependency: /Users/maxim/Appsflyer/projects/ZEVEL/NativeScriptsDemos/HelloWorld/platforms/android/libs/aar/af-android-sdk-4.8.3.aar
Running full build

Successfully synced application org.nativescript.HelloWorld on device b067ad3e.
JS: FESS :: call initSdk ... 
JS: aAF-A :: ppsFlyer.initSdk: {"devKey":"WdpTVAcYwmxsaQ4WeTspmh","appId":"975313579","isDebug":true}
JS: AppsFlyer :: NativeScript :: trackAppLaunch is called
于 2018-03-07T16:56:21.357 回答