Closed superainovacoes closed 6 years ago
Hi,
7.1.0 version requires your project to support Java 8. Please try adding the following lines to your config.xml:
<property name="java.target" value="1.8" />
<property name="java.source" value="1.8" />
Meanwhile, please let me check the iOS issue.
@superainovacoes
This iOS issue raises when you use pushwoosh-cordova-plugin@7.0.7 or higher with XCode versions lower than 9.
If you use Cordova or Phonegap CLI, please update your XCode to the latest available version.
If you use Phonegap Build, please try this branch:
https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/tree/7.1.0_xcode8_3_3
or just use pushwoosh-pgb-plugin instead of pushwoosh-cordova-plugin.
@wfhm even adding the java.target and java.source i cant compile at PGB, same error:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:775)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:741)
at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1683)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:695)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:592)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:321)
at com.android.dx.command.dexer.Main.run(Main.java:292)
at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:173)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:476)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.parseClass(Main.java:787)
at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1722)
at com.android.dx.command.dexer.Main.processClass(Main.java:773)
... 16 more
1 error; aborting
FAILURE: Build failed with an exception.
Tested with
<plugin name="pushwoosh-pgb-plugin" />
and
<plugin name="pushwoosh-cordova-plugin" />
My android config:
<preference name="android-minSdkVersion" value="15" />
<preference name="android-compileSdkVersion" value="21" />
<preference name="android-targetSdkVersion" value="21" />
<preference name="android-build-tool" value="gradle" />
<plugin name="cordova-android-support-gradle-release" />
<property name="java.target" value="1.8" />
<property name="java.source" value="1.8" />
@wfhm I was able to make build on android using an old version:
<plugin name="pushwoosh-pgb-plugin" spec="7.0.6" />
<preference name="android-minSdkVersion" value="15" />
<preference name="android-targetSdkVersion" value="19" />
<preference name="android-build-tool" value="gradle" />
but app crash when i call "initPushwoosh"
window.initPushwoosh = initPushwoosh = function() {
try {
if (window.cordova === undefined) {
return;
};
pushNotification = cordova.require("pushwoosh-cordova-plugin.PushNotification");
document.addEventListener('push-notification', SM_PushEvent);
pushNotification.onDeviceReady({
appid: pw_appid,
projectid: gcm_appid
});
pushNotification.registerDevice(function (status) {
SM_SavePUSH(status['deviceToken'] || status['pushToken'] || status);
}, function (status) {
//
});
} catch (e) {
alert('initPushwoosh.error', e);
}
};
I've updated android to
<preference name="phonegap-version" value="cli-7.0.1" />
<preference name="pgb-builder-version" value="2" />
added build-extras.gradle
ext.postBuildExtras = {
apply plugin: 'java'
android {
minSdkVersion 15
targetSdkVersion 26
compiledSdkVersion 16
buildToolsVersion "26.0.2"
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
}
also tried in gradle
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
plugin to
<plugin name="pushwoosh-pgb-plugin" />
and
<plugin name="pushwoosh-cordova-plugin" />
still failing
When i remove pushwoosh plugin pbg build works, seens like this plugin is using the last version and breaking it all.
Full PGB Log https://build.phonegap.com/apps/1910407/logs/android/build/
Hi,
Java 8 support is added in cordova-android@7.0.0, so you should intentionally use this or higher version as outlined in plugin readme:
#remove previous android platform
cordova platform remove android
#add new one with cordova-android v7.0.0
cordova platform add android@7.0.0
@superainovacoes Also, we've just rolled out 7.2.2 version of the plugin which works without Java 8 support, so you can try it as well.
@wfhm the problem was with phonegap build they do not support cordova-android@7 which we are build our app. so updating java version on config.xml or build-extras.gradle was not working
I was able to make it work with the config.xml:
<plugin name="pushwoosh-pgb-plugin" />
<preference name="android-minSdkVersion" value="15" />
<preference name="android-targetSdkVersion" value="26" />
<preference name="android-compiledSdkVersion" value="26" />
<preference name="android-buildToolsVersion" value="26.0.2" />
<preference name="android-build-tool" value="gradle" />
<plugin name="cordova-android-support-gradle-release" />
<plugin name="cordova-android-play-services-gradle-release" />
<property name="java.target" value="1.7" />
<property name="java.source" value="1.7" />
the build-extras.gradle
ext.postBuildExtras = {
apply plugin: 'java'
android {
minSdkVersion 15
targetSdkVersion 26
compiledSdkVersion 26
buildToolsVersion "26.0.2"
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
}
thanks 😀
iOS is falling with version 7.0.7, 7.0.8, 7.1.0 Androis is failling with version 7.0.7, 7.1.0 - 7.0.8 works.
iOS log
iOS config
none, using the latest on pbg
Android log
Android config