sitefinitysteve / nativescript-google-analytics

Apache License 2.0
23 stars 14 forks source link

Plugin won't compile using nativescript 4 #40

Open dammynex opened 6 years ago

dammynex commented 6 years ago

I recently updated to nativescript 4.0. And the plugin stopped working, I even created a new project and installed the plugin and still won't compile

"Failed to build plugin nativescript-social-share : Error: Command failed: ./gradlew -p /home/brainex/Projects/mp3faka/platforms/tempPlugin/nativescript_social_share assembleRelease -PcompileSdk=android-25 -PbuildToolsVersion=26.0.2 -PsupportVersion=25.3.1"

sitefinitysteve commented 6 years ago

Last PR apparently added support

Your error says "Failed to build plugin nativescript-social-share"?

dammynex commented 6 years ago

Sorry about this, I copied the wrong error message. That plugin doesn't work too.

Failed to build plugin nativescript-google-analytics : Error: Command failed: ./gradlew -p /home/brainex/Projects/mp3faka/platforms/tempPlugin/nativescript_google_analytics assembleRelease -PcompileSdk=android-25-PbuildToolsVersion=26.0.2 -PsupportVersion=25.3.1

msobocin commented 6 years ago

@dammynex try to update library, in my case work

npm update nativescript-google-analytics

dammynex commented 6 years ago

Okay, thanks. I'll try that

sitefinitysteve commented 6 years ago

I updated to 4, and made some changes, both demo apps now work fine with no real changes (superficial at best) to the plugin code itself...

https://www.screencast.com/t/sMcEEG8D

I'll re-publish, but can you dump me the FULL terminal error message?

sitefinitysteve commented 6 years ago

Up on npm now

Emmandez commented 6 years ago

Hi! How did you solve the problem? I think I have the same problem.

Unable to apply changes on device: ZY222W2F3Q. Error is: Failed to build plugin nativescript-google-analytics :
Error: Command failed: gradlew.bat -p <MyPath>\platforms\tempPlugin\nativescript_google_analytics assembleRelease -PcompileSdk=android-27 -PbuildToolsVersion=27.0.3 -PsupportVersion=26.0.0-alpha1

And then

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':releaseCompileClasspath'.
> Could not find support-v4.aar (com.android.support:support-v4:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-v4/26.1.0/support-v4-26.1.0.aar
mixaster commented 6 years ago

The jcenter url returns a 404. Is there an update or known workaround?

sitefinitysteve commented 6 years ago

This is the fix for it right? https://github.com/NativeScript/android-runtime/commit/891bd09efbfe83064e5e7ff97554fccae6449aa2#diff-f0ec8276fd420875920a31231349a391

I think it's in 4.1.1?

https://github.com/NativeScript/nativescript-cli/releases

mixaster commented 6 years ago

Unfortunately, no. Even with google listed first, for the support-v4 AAR, it tries to get it from JCenter:

image

Failed to build plugin nativescript-google-analytics :
Error: Command ./gradlew failed with exit code 1 Error output:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':releaseCompileClasspath'.
> Could not find support-v4.aar (com.android.support:support-v4:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-v4/26.1.0/support-v4-26.1.0.aar
sitefinitysteve commented 6 years ago

Can you try with the latest plugin push to npm... whatever is going on here I don't think is specific to this plugin, but eddy made a massive PR, and demo works fine

mixaster commented 6 years ago

Upgrading everything to the latest doesn't fix it. I did look into the platforms/tempPlugin/nativescript_google_analytics folder after a build attempt, and the build.gradle file there has the jcenter() repository listed first:


buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenLocal()
        mavenCentral()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

apply plugin: 'com.android.library'

def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 24 }
def computeBuildToolsVersion = { ->
    project.hasProperty("buildToolsVersion") ? buildToolsVersion : "27.0.3"
}

android {
    compileSdkVersion computeCompileSdkVersion()
    buildToolsVersion computeBuildToolsVersion()

    defaultConfig {
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
}

dependencies {
    def supportVer = "27.0.1"
    if (project.hasProperty("supportVersion")) {
        supportVer = supportVersion
    }
    compileOnly "com.android.support:support-v4:$supportVer"
    compileOnly "com.android.support:appcompat-v7:$supportVer"
}

dependencies {
    // [START gms_compile]
    def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : '+'
    compile "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion"
    // [END gms_compile]
}

...at least in the allprojects section. It seems like it's not checking anything but jcenter.

sitefinitysteve commented 6 years ago

Where am i fixing that though? I don't specify that anywhere.

I'll see what the team says

On Wed, Jun 27, 2018, 4:52 PM Matt Fox notifications@github.com wrote:

Upgrading everything to the latest doesn't fix it. I did look into the platforms/tempPlugin/nativescript_google_analytics folder after a build attempt, and the build.gradle file there has the jcenter() repository listed first:

buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects { repositories { jcenter() mavenLocal() mavenCentral() maven { url 'https://maven.google.com/' name 'Google' } } }

apply plugin: 'com.android.library'

def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : 24 } def computeBuildToolsVersion = { -> project.hasProperty("buildToolsVersion") ? buildToolsVersion : "27.0.3" }

android { compileSdkVersion computeCompileSdkVersion() buildToolsVersion computeBuildToolsVersion()

defaultConfig {
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
}

}

dependencies { def supportVer = "27.0.1" if (project.hasProperty("supportVersion")) { supportVer = supportVersion } compileOnly "com.android.support:support-v4:$supportVer" compileOnly "com.android.support:appcompat-v7:$supportVer" }

dependencies { // [START gms_compile] def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : '+' compile "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion" // [END gms_compile] }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sitefinitysteve/nativescript-google-analytics/issues/40#issuecomment-400825037, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeI6M6XXcY-KcE52spC_vnMk_s9AMmYks5uA_BxgaJpZM4Tsx2O .

mixaster commented 6 years ago

Looks like this is still an open issue with the android runtime: https://github.com/NativeScript/android-runtime/issues/1081

This issue can be closed, but hope it helps someone else.