Google Analytics in Android ( play services)

Hi there,
I just want to use this package for Google Analytics in Android, thanks to @erick

But I realize that, when I build test app its okay but in the actual app with push notifications and google maps dependencies its throw an error like

A problem occurred configuring project ':app'.
> For input string: "+"  

It caused by “Fuse.PushNotifications”, “Fuse.Maps” Packages dependencies i think.

In my example PushNotifications and Maps adds these lines

compile 'com.google.android.gms:play-services-maps:+'
compile 'com.google.android.gms:play-services-gcm:+'

Google Analytics Package adds this

compile 'com.google.android.gms:play-services-analytics:9.4.0'

It works well when I change to all dependencies to

compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.google.android.gms:play-services-analytics:9.4.0'

How can I bypass that (+) issue?

Hi cosku, this is odd.

Could you post the full build log here? Also could you paste the build.gradle file from under the app directory?

That might give us some clues to work with.

Also I think that regardless of the outcome, I need to go change the versions from + to 9.4.0 anyway, too risky to leave them like that. I may already have a branch with this fix.

Hi chris,
Yes this odd.

Here is build log;


Configuring (6.6 s)
Compiling syntax tree (4.4 s)
Generating code and data (16.1 s)
Building Android app
2/2: BauApp.apk

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> For input string: "+"

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
## 2/2: BauApp.apk
please apply google-services plugin at the bottom of the build file.

BUILD FAILED

Total time: 12.805 secs
(unknown): E0200: Android build failed
(13.7 s)

Build completed in 40.95 seconds
    1 error

fuse: Errors were encountered while building the project

Also build file;

apply plugin: 'com.android.model.application'

dependencies {
    compile fileTree(dir: 'src/main/libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
//#if #(Gradle.Dependency.Compile:IsRequired)
    compile 'com.google.android.gms:play-services-gcm:+'
    compile 'com.google.android.gms:play-services-maps:+'
    compile 'com.google.android.gms:play-services-analytics:9.4.0'
//#endif
//#if #(Gradle.Dependency:IsRequired)
//    #(Gradle.Dependency:Join('\n'))
//#endif
}


task copySharedLibraries {
    copy {
        from '/Users/coskudemirhan/Library/Application Support/Fusetools/Fuse/Android/AndroidNDK/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_shared.so'
        into file('src/main/jniLibs/armeabi-v7a')
    }
    copy {
        from '/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/Fuse.Scripting.V8/0.43.11/lib/Android/libV8Simple.so'
        into file('src/main/jniLibs/armeabi-v7a')
    }
}

build.dependsOn copySharedLibraries

//#if #(Gradle.Repository:IsRequired)
//repositories {
//    #(Gradle.Repository:Join('\n'))
//}
//#endif

model {
    repositories {
//#if #(JNI.SystemLibrary:IsSet || JNI.SharedLibrary:IsSet)
//        libs(PrebuiltLibraries) {
//            prebuilt {
//                binaries.withType(SharedLibraryBinary) {
//                    #(JNI.SystemLibrary:Join('\n                    ', 'sharedLibraryFile = file(\'', '\')'))
//                    #(JNI.SharedLibrary:Join('\n                    ', 'sharedLibraryFile = file(\'', '\')'))
//                }
//            }
//        }
//#endif
//#if #(Gradle.Model.Repository:IsRequired)
//        #(Gradle.Model.Repository:Join('\n'))
//#endif
    }

    android.lintOptions {
        checkReleaseBuilds = false
    }

    android {
        compileSdkVersion = 23
        buildToolsVersion = "23.0.2"

        defaultConfig.with {
            applicationId = "com.apps.bauapp"
            minSdkVersion.apiLevel = 16
            targetSdkVersion.apiLevel = 23
            versionCode = 3
            versionName = "0.0.3"
        }
    }

//#if #(Project.Android.Key.Store:IsSet)
    android.signingConfigs {
        create("release") {
            keyAlias = "BAU"
            keyPassword = "*****"
            storeFile = file("/Users/coskudemirhan/Copy/Projeler/bauapp_mobile/BauApp/release.keystore")
            storePassword = "******"
        }
    }
//#endif

    android.ndk {
        moduleName = "BauApp"
        debuggable = true
        platformVersion = 9
        CFlags.addAll(["-std=c99"])
        CFlags.addAll(["-I/Users/coskudemirhan/Copy/Projeler/bauapp_mobile/BauApp/build/Android/Debug/BauApp/app/src/main/include", "-I/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/include", "-I/Users/coskudemirhan/Library/Application Support/Fusetools/Fuse/Android/AndroidNDK/sources/android/support/include", "-I/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/Fuse.Scripting.V8/0.43.11"])
        CFlags.addAll([])
        cppFlags.addAll(["-std=c++11", "-fexceptions", "-frtti", "-Wno-invalid-offsetof"])
        cppFlags.addAll(["-I/Users/coskudemirhan/Copy/Projeler/bauapp_mobile/BauApp/build/Android/Debug/BauApp/app/src/main/include", "-I/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/include", "-I/Users/coskudemirhan/Library/Application Support/Fusetools/Fuse/Android/AndroidNDK/sources/android/support/include", "-I/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/Fuse.Scripting.V8/0.43.11"])
        cppFlags.addAll([])
        ldFlags.addAll(["-L/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/lib/armeabi-v7a", "-L/Users/coskudemirhan/Library/Application Support/Fusetools/Fuse/Android/AndroidNDK/sources/cxx-stl/stlport/libs/armeabi-v7a", "-L/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/Fuse.Scripting.V8/0.43.11/lib/Android"])
        ldLibs.addAll(["/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/lib/armeabi-v7a/libuImage.a", "/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/lib/armeabi-v7a/libpng.a", "/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/lib/armeabi-v7a/libjpeg.a", "/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/lib/armeabi-v7a/libfreetype.a", "/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/lib/armeabi-v7a/libXliMain.a", "/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/lib/armeabi-v7a/libXliPlatform.a", "/Users/coskudemirhan/Library/Application Support/Fusetools/Packages/UnoCore/0.43.8/prebuilt/Android/lib/armeabi-v7a/libuBase.a"])
        ldLibs.addAll(["android", "log", "stlport_shared", "V8Simple", "EGL", "GLESv2", "z"])
        stl = "stlport_shared"
    }

    android.sources {
        main {
//#if #(JNI.SystemLibrary:IsSet || JNI.SharedLibrary:IsSet)
//            jni {
//                dependencies {
//                    library "prebuilt"
//                }
//            }
//#endif
        }
    }

    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles.add(file('proguard-rules.txt'))
//#if #(Project.Android.Key.Store:IsSet)
            signingConfig = $("android.signingConfigs.release")
//#endif
        }
    }

    android.productFlavors {
        // for detailed abiFilter descriptions, refer to "Supported ABIs" @
        // https://developer.android.com/ndk/guides/abis.html#sa
        create("arm7") {
            ndk.abiFilters.add("armeabi-v7a")
        }
    }
}
apply plugin: 'com.google.gms.google-services'

Thank you for your interest.

Hi there, I was just curious.
Is there any workaround about this issue? We were planning an update for our application. If its will not be fixed in soon, I’ve to bypass these dependencies.

I am having the same problem but using Firebase Analytics (https://github.com/fuse-compound/Fuse.Firebase)

Uno 0.45.1 (build 4817) OS X 10.12 i386 a4caf29

Configuring (5.2 s)
Compiling syntax tree (2.3 s)
Generating code and data (8.6 s)
Building Android app
2/2: Criminal Mind.apk


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> For input string: "+"

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
## 2/2: Criminal Mind.apk
please apply google-services plugin at the bottom of the build file.

UPDATE: I can now confirm the issue happens when I add Fuse.PushNotifications to my packages. If I remove it everything is perfect.

Good stuff luis, this also confirms cosku’s findings

I’m pretty sure that the issue is that when we have been pulling the dependencies from gradle we have been using + for the version (which should pull the latest) however this could be causing issues. What is annoying is that it doesn’t affect us here :expressionless:

I’ll force the version to be 9.2.0 which is the same as we are using for firebase’s gms dependencies.

Thanks again.

The change that sets the version to 9.2.0 is in. Will be in the Fuse 0.36 release