Closed SebDigital closed 7 years ago
Hi,
We could not reproduce the issue on our side. Could you please describe how you do add pushwoosh library in a bit more details?
Hi, thanks for coming back to me.
So I have just done the install in terminal using: cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#7.0.4
Then, launch Android Studio and click 'Build APK' then I have these errors.
All the import scripts are greyed out for some reason, it looks like I must be missing something.
See screenshot Attached:
Thanks!
Seb
Hi,
Thanks for the clarification. Could you please share your build.gradle as well?
Hi,
Here is the build.gradle (android) file:
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
apply plugin: 'com.android.application'
buildscript { repositories { mavenCentral() jcenter() }
// Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
}
}
// Allow plugins to declare Maven dependencies via build-extras.gradle. allprojects { repositories { mavenCentral(); jcenter() } }
task wrapper(type: Wrapper) { gradleVersion = '2.14.1' }
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties. // Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html ext { apply from: 'CordovaLib/cordova.gradle' // The value for android.compileSdkVersion. if (!project.hasProperty('cdvCompileSdkVersion')) { cdvCompileSdkVersion = null; } // The value for android.buildToolsVersion. if (!project.hasProperty('cdvBuildToolsVersion')) { cdvBuildToolsVersion = null; } // Sets the versionCode to the given value. if (!project.hasProperty('cdvVersionCode')) { cdvVersionCode = null } // Sets the minSdkVersion to the given value. if (!project.hasProperty('cdvMinSdkVersion')) { cdvMinSdkVersion = null } // Whether to build architecture-specific APKs. if (!project.hasProperty('cdvBuildMultipleApks')) { cdvBuildMultipleApks = null } // .properties files to use for release signing. if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) { cdvReleaseSigningPropertiesFile = null } // .properties files to use for debug signing. if (!project.hasProperty('cdvDebugSigningPropertiesFile')) { cdvDebugSigningPropertiesFile = null } // Set by build.js script. if (!project.hasProperty('cdvBuildArch')) { cdvBuildArch = null }
// Plugin gradle extensions can append to this to have code run at the end.
cdvPluginPostBuildExtras = []
}
// PLUGIN GRADLE EXTENSIONS START apply from: "card.io.cordova.mobilesdk/enerate-build.gradle" apply from: "com.paypal.cordova.mobilesdk/enerate-build.gradle" // PLUGIN GRADLE EXTENSIONS END
def hasBuildExtras = file('build-extras.gradle').exists() if (hasBuildExtras) { apply from: 'build-extras.gradle' }
// Set property defaults after extension .gradle files. if (ext.cdvCompileSdkVersion == null) { ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget() } if (ext.cdvBuildToolsVersion == null) { ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools() } if (ext.cdvDebugSigningPropertiesFile == null && file('debug-signing.properties').exists()) { ext.cdvDebugSigningPropertiesFile = 'debug-signing.properties' } if (ext.cdvReleaseSigningPropertiesFile == null && file('release-signing.properties').exists()) { ext.cdvReleaseSigningPropertiesFile = 'release-signing.properties' }
// Cast to appropriate types. ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean(); ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : Integer.parseInt('' + cdvMinSdkVersion) ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
def computeBuildTargetName(debugBuild) { def ret = 'assemble' if (cdvBuildMultipleApks && cdvBuildArch) { def arch = cdvBuildArch == 'arm' ? 'armv7' : cdvBuildArch ret += '' + arch.toUpperCase().charAt(0) + arch.substring(1); } return ret + (debugBuild ? 'Debug' : 'Release') }
// Make cdvBuild a task that depends on the debug/arch-sepecific task. task cdvBuildDebug cdvBuildDebug.dependsOn { return computeBuildTargetName(true) }
task cdvBuildRelease cdvBuildRelease.dependsOn { return computeBuildTargetName(false) }
task cdvPrintProps << { println('cdvCompileSdkVersion=' + cdvCompileSdkVersion) println('cdvBuildToolsVersion=' + cdvBuildToolsVersion) println('cdvVersionCode=' + cdvVersionCode) println('cdvMinSdkVersion=' + cdvMinSdkVersion) println('cdvBuildMultipleApks=' + cdvBuildMultipleApks) println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile) println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile) println('cdvBuildArch=' + cdvBuildArch) println('computedVersionCode=' + android.defaultConfig.versionCode) android.productFlavors.each { flavor -> println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode) } }
android { sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] jniLibs.srcDirs = ['libs'] } }
defaultConfig {
versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
applicationId privateHelpers.extractStringFromManifest("package")
if (cdvMinSdkVersion != null) {
minSdkVersion cdvMinSdkVersion
}
}
lintOptions {
abortOnError false;
}
compileSdkVersion cdvCompileSdkVersion
buildToolsVersion cdvBuildToolsVersion
if (Boolean.valueOf(cdvBuildMultipleApks)) {
productFlavors {
armv7 {
versionCode defaultConfig.versionCode*10 + 2
ndk {
abiFilters "armeabi-v7a", ""
}
}
x86 {
versionCode defaultConfig.versionCode*10 + 4
ndk {
abiFilters "x86", ""
}
}
all {
ndk {
abiFilters "all", ""
}
}
}
}
/*
ELSE NOTHING! DON'T MESS WITH THE VERSION CODE IF YOU DON'T HAVE TO!
else if (!cdvVersionCode) {
def minSdkVersion = cdvMinSdkVersion ?: privateHelpers.extractIntFromManifest("minSdkVersion")
// Vary versionCode by the two most common API levels:
// 14 is ICS, which is the lowest API level for many apps.
// 20 is Lollipop, which is the lowest API level for the updatable system webview.
if (minSdkVersion >= 20) {
defaultConfig.versionCode += 9
} else if (minSdkVersion >= 14) {
defaultConfig.versionCode += 8
}
}
*/
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
if (cdvReleaseSigningPropertiesFile) {
signingConfigs {
release {
// These must be set or Gradle will complain (even if they are overridden).
keyAlias = ""
keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph.
storeFile = null
storePassword = "__unset"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
addSigningProps(cdvReleaseSigningPropertiesFile, signingConfigs.release)
}
if (cdvDebugSigningPropertiesFile) {
addSigningProps(cdvDebugSigningPropertiesFile, signingConfigs.debug)
}
}
dependencies { compile fileTree(dir: 'libs', include: '*.jar') // SUB-PROJECT DEPENDENCIES START debugCompile(project(path: "CordovaLib", configuration: "debug")) releaseCompile(project(path: "CordovaLib", configuration: "release")) debugCompile(project(path: "phonegap-facebook-plugin:FacebookLib", configuration: "debug")){ exclude module:("CordovaLib") } releaseCompile(project(path: "phonegap-facebook-plugin:FacebookLib", configuration: "release")){ exclude module:("CordovaLib") } //compile "com.google.android.gms:play-services:7.5.+" // SUB-PROJECT DEPENDENCIES END }
def promptForReleaseKeyPassword() { if (!cdvReleaseSigningPropertiesFile) { return; } if ('unset'.equals(android.signingConfigs.release.storePassword)) { android.signingConfigs.release.storePassword = privateHelpers.promptForPassword('Enter key store password: ') } if ('unset'.equals(android.signingConfigs.release.keyPassword)) { android.signingConfigs.release.keyPassword = privateHelpers.promptForPassword('Enter key password: '); } }
gradle.taskGraph.whenReady { taskGraph -> taskGraph.getAllTasks().each() { task -> if (task.name == 'validateReleaseSigning' || task.name == 'validateSigningRelease') { promptForReleaseKeyPassword() } } }
def addSigningProps(propsFilePath, signingConfig) { def propsFile = file(propsFilePath) def props = new Properties() propsFile.withReader { reader -> props.load(reader) }
def storeFile = new File(props.get('key.store') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'storeFile'))
if (!storeFile.isAbsolute()) {
storeFile = RelativePath.parse(true, storeFile.toString()).getFile(propsFile.getParentFile())
}
if (!storeFile.exists()) {
throw new FileNotFoundException('Keystore file does not exist: ' + storeFile.getAbsolutePath())
}
signingConfig.keyAlias = props.get('key.alias') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'keyAlias')
signingConfig.keyPassword = props.get('keyPassword', props.get('key.alias.password', signingConfig.keyPassword))
signingConfig.storeFile = storeFile
signingConfig.storePassword = props.get('storePassword', props.get('key.store.password', signingConfig.storePassword))
def storeType = props.get('storeType', props.get('key.store.type', ''))
if (!storeType) {
def filename = storeFile.getName().toLowerCase();
if (filename.endsWith('.p12') || filename.endsWith('.pfx')) {
storeType = 'pkcs12'
} else {
storeType = signingConfig.storeType // "jks"
}
}
signingConfig.storeType = storeType
}
for (def func : cdvPluginPostBuildExtras) { func() }
// This can be defined within build-extras.gradle as: // ext.postBuildExtras = { ... code here ... } if (hasProperty('postBuildExtras')) { postBuildExtras() }
Thanks, let me know if you need anything else
Seb
This is very strange. We could not find anything Pushwoosh-related in the build.gradle. Did you try removing and re-adding the plugin?
Yes I have done this few time :( Maybe If you send me what should be in the build.gradle and I add it manually..do you think that will work?
Not sure it will work, but let's give it a shot. Add the following lines to your build.gradle:
// PLUGIN GRADLE EXTENSIONS START apply from: "pushwoosh-cordova-plugin/enerate.gradle" // PLUGIN GRADLE EXTENSIONS END
dependencies { compile fileTree(dir: 'libs', include: '*.jar') // SUB-PROJECT DEPENDENCIES START debugCompile(project(path: "CordovaLib", configuration: "debug")) releaseCompile(project(path: "CordovaLib", configuration: "release")) compile "com.google.android.gms:play-services-gcm:+" compile "com.google.android.gms:play-services-location:+" compile "com.android.support:support-v4:25.+" compile "com.pushwoosh:pushwoosh:5.0.2" compile "com.pushwoosh:pushwoosh-badge:5.0.2" compile "com.pushwoosh:pushwoosh-location:5.0.2" compile "com.pushwoosh:pushwoosh-beacon:5.0.2" compile "com.pushwoosh:pushwoosh-experimental:5.0.2" compile "com.pushwoosh:pushwoosh-amazon:5.0.2" // SUB-PROJECT DEPENDENCIES END }
Thanks, I have added it and I have this error:
Error:(93, 0) Could not read script '/Users/sebdigital/Documents/SEBDIGITAL/localserver/eneratenew/enerate/platforms/android/pushwoosh-cordova-plugin/enerate.gradle' as it does not exist.
Thanks!
Seb
Error:(93, 0) Could not read script '/Users/sebdigital/Documents/SEBDIGITAL/localserver/eneratenew/enerate/platforms/android/pushwoosh-cordova-plugin/enerate.gradle' as it does not exist.
It should look similar to this:
apply from: "card.io.cordova.mobilesdk/enerate-build.gradle"
Try replacing
apply from: "pushwoosh-cordova-plugin/enerate.gradle"
with
apply from: "pushwoosh-cordova-plugin/enerate-build.gradle"
Thanks but no luck :(
See error message:
Error:(93, 1) A problem occurred evaluating root project 'android'.
Could not read script '/Users/sebdigital/Documents/SEBDIGITAL/localserver/eneratenew/enerate/platforms/android/pushwoosh-cordova-plugin/enerate-build.gradle' as it does not exist.
Thanks!
Seb
Check the '/Users/sebdigital/Documents/SEBDIGITAL/localserver/eneratenew/enerate/platforms/android/pushwoosh-cordova-plugin folder. There should be just one file, use its name instead of 'enerate-build.gradle'.
Hi,
Thanks so much!!! it is working now, also I had to add: for the compile bit: compile "com.google.android.gms:play-services-gcm:11.0.0" compile "com.google.android.gms:play-services-location:11.0.0" compile "com.android.support:support-v4:25.3.1" compile "com.pushwoosh:pushwoosh:5.0.2" compile "com.pushwoosh:pushwoosh-badge:5.0.2" compile "com.pushwoosh:pushwoosh-location:5.0.2" compile "com.pushwoosh:pushwoosh-beacon:5.0.2" compile "com.pushwoosh:pushwoosh-experimental:5.0.2" compile "com.pushwoosh:pushwoosh-amazon:5.0.2"
and
android { ..... defaultConfig { ..... multiDexEnabled = true (this line) }
But all tested and all working now :) Thank so much for your help, I wouldn't have made it work without your help!!!
Seb
Hi,
The plugin is working good on iOS but I have this error on Android when building the app:
Error:(3, 21) error: cannot find symbol class Pushwoosh Error:(4, 30) error: package com.pushwoosh.function does not exist Error:(8, 52) error: cannot find symbol class Callback /platforms/android/src/com/pushwoosh/plugin/pushnotifications/UnregisterForPushNotificationException.java Error:(3, 31) error: package com.pushwoosh.exception does not exist Error:(5, 61) error: cannot find symbol class PushwooshException /platforms/android/src/com/pushwoosh/plugin/pushnotifications/PushwooshNotificationServiceExtension.java Error:(6, 34) error: package com.pushwoosh.notification does not exist Error:(7, 34) error: package com.pushwoosh.notification does not exist Error:(9, 60) error: cannot find symbol class NotificationServiceExtension Error:(18, 47) error: cannot find symbol class PushMessage Error:(23, 52) error: cannot find symbol class PushMessage Error:(31, 54) error: cannot find symbol class PushMessage Error:(36, 36) error: cannot find symbol class PushMessage Error:(17, 5) error: method does not override or implement a method from a supertype Error:(19, 44) error: cannot find symbol method getApplicationContext() Error:(20, 16) error: cannot find symbol variable super Error:(27, 9) error: cannot find symbol method getApplicationContext() Error:(30, 5) error: method does not override or implement a method from a supertype Error:(32, 9) error: cannot find symbol variable super Error:(37, 42) error: cannot find symbol method getApplicationContext() /platforms/android/src/com/pushwoosh/plugin/pushnotifications/PushNotifications.java Error:(25, 21) error: cannot find symbol class Pushwoosh Error:(26, 27) error: package com.pushwoosh.badge does not exist Error:(27, 28) error: package com.pushwoosh.beacon does not exist Error:(28, 31) error: package com.pushwoosh.exception does not exist Error:(29, 31) error: package com.pushwoosh.exception does not exist Error:(30, 31) error: package com.pushwoosh.exception does not exist Error:(31, 30) error: package com.pushwoosh.function does not exist Error:(32, 30) error: package com.pushwoosh.function does not exist Error:(33, 27) error: package com.pushwoosh.inapp does not exist Error:(34, 45) error: package com.pushwoosh.internal.platform.utils does not exist Error:(35, 36) error: package com.pushwoosh.internal.utils does not exist Error:(36, 30) error: package com.pushwoosh.location does not exist Error:(37, 34) error: package com.pushwoosh.notification does not exist Error:(38, 34) error: package com.pushwoosh.notification does not exist Error:(39, 34) error: package com.pushwoosh.notification does not exist Error:(40, 34) error: package com.pushwoosh.notification does not exist Error:(41, 34) error: package com.pushwoosh.notification does not exist Error:(42, 34) error: package com.pushwoosh.notification does not exist Error:(43, 26) error: package com.pushwoosh.tags does not exist Error:(44, 26) error: package com.pushwoosh.tags does not exist Error:(168, 23) error: cannot find symbol variable Pushwoosh Error:(169, 53) error: cannot find symbol variable Pushwoosh Error:(174, 5) error: cannot find symbol variable PWLog Error:(185, 24) error: cannot find symbol variable Pushwoosh Error:(186, 49) error: cannot find symbol variable Pushwoosh Error:(199, 4) error: cannot find symbol variable PWLog Error:(210, 4) error: cannot find symbol variable PWLog Error:(212, 4) error: cannot find symbol variable PWLog Error:(228, 4) error: cannot find symbol variable Pushwoosh Error:(229, 4) error: cannot find symbol variable Pushwoosh Error:(231, 4) error: cannot find symbol variable PWLog Error:(243, 61) error: cannot find symbol class Callback Error:(243, 78) error: cannot find symbol class RegisterForPushNotificationsException Error:(243, 4) error: cannot find symbol variable Pushwoosh Error:(256, 4) error: cannot find symbol variable PWLog Error:(270, 57) error: cannot find symbol class Callback Error:(294, 4) error: cannot find symbol variable PWLog Error:(299, 36) error: cannot find symbol variable Tags Error:(299, 63) error: cannot find symbol class Callback Error:(299, 78) error: cannot find symbol class PushwooshException Error:(299, 3) error: cannot find symbol variable Pushwoosh Error:(324, 39) error: cannot find symbol class Callback Error:(324, 48) error: cannot find symbol class TagsBundle Error:(324, 60) error: cannot find symbol class GetTagsException Error:(324, 3) error: cannot find symbol variable Pushwoosh Error:(344, 27) error: cannot find symbol variable Pushwoosh Error:(350, 27) error: cannot find symbol variable Pushwoosh Error:(356, 21) error: cannot find symbol method checkSelfPermission(Activity,String) Error:(356, 161) error: cannot find symbol method checkSelfPermission(Activity,String) Error:(360, 3) error: cannot find symbol variable PushwooshLocation Error:(367, 3) error: cannot find symbol variable PushwooshLocation Error:(374, 3) error: cannot find symbol variable PushwooshBeacon Error:(381, 3) error: cannot find symbol variable PushwooshBeacon Error:(391, 4) error: cannot find symbol variable PushwooshBeacon Error:(395, 4) error: cannot find symbol variable PWLog Error:(412, 4) error: cannot find symbol variable PWLog Error:(432, 4) error: cannot find symbol class LocalNotification Error:(432, 58) error: package LocalNotification does not exist Error:(437, 4) error: cannot find symbol variable Pushwoosh Error:(441, 4) error: cannot find symbol variable PWLog Error:(451, 3) error: cannot find symbol variable LocalNotificationReceiver Error:(458, 3) error: cannot find symbol class PushMessage Error:(458, 36) error: cannot find symbol variable Pushwoosh Error:(470, 3) error: cannot find symbol variable Pushwoosh Error:(477, 3) error: cannot find symbol variable PushwooshNotificationSettings Error:(484, 3) error: cannot find symbol variable PushwooshNotificationSettings Error:(497, 59) error: cannot find symbol variable SoundType Error:(497, 4) error: cannot find symbol variable PushwooshNotificationSettings Error:(501, 4) error: cannot find symbol variable PWLog Error:(517, 61) error: cannot find symbol variable VibrateType Error:(517, 4) error: cannot find symbol variable PushwooshNotificationSettings Error:(521, 4) error: cannot find symbol variable PWLog Error:(534, 4) error: cannot find symbol variable PushwooshNotificationSettings Error:(538, 4) error: cannot find symbol variable PWLog Error:(551, 4) error: cannot find symbol variable PushwooshNotificationSettings Error:(555, 4) error: cannot find symbol variable PWLog Error:(571, 19) error: cannot find symbol variable GeneralUtils Error:(572, 4) error: cannot find symbol variable PushwooshNotificationSettings Error:(576, 4) error: cannot find symbol variable PWLog Error:(586, 8) error: cannot find symbol class PushMessage Error:(586, 42) error: cannot find symbol variable Pushwoosh Error:Execution failed for task ':compileDebugJavaWithJavac'.
Thanks so much!
Seb