Cannot Change Strategy of Configuration SQLite - sqlite

In my Gradle project, I have a dependency for SQLite.
Here is my build.gradle:
import groovy.sql.Sql
buildscript {
ext{
osPackageVersion = "3.4.0"
kotlin_version = '1.2.41'
requery_version = '1.5.1'
sqlite_jdbc = '3.7.2'
rxkotlin_version = '2.2.0'
sqlDirPath = "src" + File.separator + "main" + File.separator + "Resources" + File.separator + "TestAppDbInit.sql"
}
repositories {
mavenCentral()
jcenter()
maven{
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "edu.sc.seis.gradle:launch4j:2.4.4"
classpath group: 'org.jooq', name: 'jooq-meta-extensions', version: '3.11.2'
classpath 'org.jooq:jooq-codegen:3.11.2'
classpath 'org.xerial:sqlite-jdbc:3.7.2'
}
}
plugins {
id 'java'
id 'nu.studer.jooq' version '3.0.1'
}
group 'org.wycliffeassociates.translationrecorder'
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'edu.sc.seis.launch4j'
sourceCompatibility = 1.8
configurations {
sqllite
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://jitpack.io'}
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://mvnrepository.com/artifac/'}
maven { url "https://dl.bintray.com/kotlin/exposed" }
maven { url "https://dl.bintray.com/dua3/public" }
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
compile "no.tornado:tornadofx:1.7.16"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "com.github.thomasnield:rxkotlinfx:2.2.2"
compile "io.reactivex.rxjava2:rxkotlin:$rxkotlin_version"
compile 'org.jooq:jooq:3.11.2'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: "$sqlite_jdbc"
jooqRuntime group: 'org.jooq', name: 'jooq-meta-extensions', version: '3.11.2'
jooqRuntime 'org.xerial:sqlite-jdbc:3.7.2'
sqllite 'org.xerial:sqlite-jdbc:3.7.2'
kapt "io.requery:requery-processor:$requery_version"
compile "com.squareup.retrofit2:retrofit:2.0.0"
compile "com.squareup.retrofit2:converter-moshi:2.0.0"
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.google.dagger:dagger:2.16'
kapt 'com.google.dagger:dagger-compiler:2.16'
implementation 'com.github.WycliffeAssociates:8woc2018-common:dev-SNAPSHOT'
compile 'com.github.WycliffeAssociates:jdenticon-kotlin:-SNAPSHOT'
compile 'de.jensd:fontawesomefx-commons:9.1.2-jpms'
compile 'de.jensd:fontawesomefx-materialicons:2.2.0-9.1.2-jpms'
compile 'de.jensd:fontawesomefx-icons525:4.2.0-9.1.2-jpms'
compile 'com.github.afester.FranzXaver:Examples:0.1'
compile 'com.jfoenix:jfoenix:8.0.5' // Java 8
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile "org.mockito:mockito-core:2.+"
testCompile "org.mockito:mockito-core:2.+"
testCompile 'org.powermock:powermock-module-junit4:2.+'
testCompile 'org.powermock:powermock-module-junit4-rule:2.+'
testCompile 'org.powermock:powermock-api-mockito2:2.+'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
URLClassLoader loader = GroovyObject.class.classLoader
configurations.sqllite.each { File file ->
loader.addURL(file.toURL())
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
I try to run the build for the project, and I get the following error:
Caused by: org.gradle.api.InvalidUserDataException: Cannot change strategy of configuration ':sqllite' after it has been resolved.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.preventIllegalMutation(DefaultConfiguration.java:896)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.validateMutation(DefaultConfiguration.java:867)
at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultCachePolicy.eachModule(DefaultCachePolicy.java:161)
at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultCachePolicy.cacheChangingModulesFor(DefaultCachePolicy.java:121)
at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultResolutionStrategy.cacheChangingModulesFor(DefaultResolutionStrategy.java:190)
at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultResolutionStrategy.cacheChangingModulesFor(DefaultResolutionStrategy.java:186)
at org.gradle.api.artifacts.ResolutionStrategy$cacheChangingModulesFor.call(Unknown Source)
at build_2rl70kyg6ax354v7xbsnpa8n1$_run_closure8.doCall(C:\Users\dipinton\8woc2018-jvm\build.gradle:114)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:71)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:155)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:106)
at org.gradle.util.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:167)
at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:158)
at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:174)
at org.gradle.api.DomainObjectCollection$all.call(Unknown Source)
at build_2rl70kyg6ax354v7xbsnpa8n1.run(C:\Users\dipinton\8woc2018-jvm\build.gradle:113)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
... 99 more
It's my impression that this error I'm receiving has to do with the fact that I have 2 configurations blocks. One for configuring my SQLite module, and another for handling the resolution strategy of all modules. These two closures seem to be conflicting with one another.
Does anyone have any suggestions on how to remove the conflict between these two closures?

This working with addUrl on the copy of configuration:
def sqliteCopy = configurations.sqlite.copy()
sqliteCopy.each {File file ->
loader.addURL(file.toURI().toURL())
}
instead of:
configurations.sqllite.each { File file ->
loader.addURL(file.toURL())
}
or downgrade com.android.tools.build:gradle to 3.1.4 version.

Related

how to setup gradle for TornadoFx/JavaFx

I'm trying to create a TornadoFx project in IntelliJ ide..
on build it shows the error
Error: JavaFX runtime components are missing, and are required to run this application
here's the build.gradle file
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.40'
id 'org.openjfx.javafxplugin' version '0.0.7'
}
javafx {
version = "12"
modules = ['javafx.controls', 'javafx.base', 'javafx.fxml', 'javafx.graphics']
}
group 'tornado1'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation 'no.tornado:tornadofx:1.7.19'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
and a screenshot of the libraries in the project structure

Release apk has closed immediately when open in android devices (Recat -native)

Android Release apk has stopen when open it in react -native
*****E/AndroidRuntime: FATAL EXCEPTION: Thread-3
Process: com.reactapp, PID: 4023
java.lang.ExceptionInInitializerError
at com.facebook.react.bridge.p.a(Unknown Source)
at com.facebook.react.k$5.run(Unknown Source)
at java.lang.Thread.run(Thread.java:761)
****Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.bridge.ProxyJavaScriptExecutor" on path: DexPathList[[zip file "/data/app/com.reactapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.reactapp-2/lib/arm, /data/app/com.reactapp-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/vendor/lib]]****
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Runtime.nativeLoad(Native Method)
at java.lang.Runtime.doLoad(Runtime.java:1060)
at java.lang.Runtime.load0(Runtime.java:895)
at java.lang.System.load(System.java:1505)
at com.facebook.l.b.a(Unknown Source)
at com.facebook.l.b.a(Unknown Source)
at com.facebook.l.g.a(Unknown Source)
at com.facebook.l.g.a(Unknown Source)
at com.facebook.react.bridge.ao.a(Unknown Source)
at com.facebook.react.bridge.NativeMap.<clinit>(Unknown Source)
at com.facebook.react.bridge.p.a(Unknown Source) 
at com.facebook.react.k$5.run(Unknown Source) 
at java.lang.Thread.run(Thread.java:761)***** 
What Should I do For That can Any One Help Me For that
I am use here react-native-fcm and react-native-device-info in this project
#
List item Build.gradle gere
#
`android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.reactapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
packagingOptions {
exclude "lib/arm64-v8a/librealm-jni.so"
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk true // If true, also generate a universal APK
}
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
/* packagingOptions {
exclude '/lib/mips64/**'
exclude '/lib/arm64-v8a/**'
exclude '/lib/x86_64/**'
}*/
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-fcm')
implementation fileTree(dir: "libs", include: ["*.jar"])
// implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-device-info')
/*implementation 'com.android.support:multidex:1.0.0'*/
implementation 'com.google.code.gson:gson:2.8.5'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: "com.google.gms.google-services"

Qbs custom module not working

I want to make a module to use the QtRO repc compiler to produce .h files from .rep files.
I coded the module but when I try to load it in an application product it does not load and disable the product.
the modules are in C:\Users\User\qt\qbs
Qbs Module replica.qbs:
import qbs
Module {
property bool source: true
FileTagger {
patterns: "*.rep"
fileTags: ["rep"]
}
Rule {
inputs: ["rep"]
Artifact {
fileTags: ["txt_output"]
}
prepare: {
var cmd = new Command();
cmd.program = "repc.exe";
if source {
cmd.arguments = ["-i", "rep", "-o", "source", input.filePath];
} else {
cmd.arguments = ["-i", "rep", "-o", "replica", input.filePath];
}
console.log("repc on : ", input.filePath);
return [cmd];
}
}
}
product.qbs:
import qbs
Application {
name: "ServiceExposer"
Depends { name: "cpp" }
Depends { name: "Qt.core" }
Depends { name: "Qt.remoteobjects" }
Depends { name: "replica" }
files: [
"main.cpp",
"service_exposer.rep"
]
}
project.qbs:
import qbs
Project {
references: ["ServiceExposer/ServiceExposer.qbs"]
qbsSearchPaths: "C:\Users\User\qt\qbs"
}
I don't see where I made the mistake.
Thank you in advance for your help.
If it's a header file, why do you give it the "cpp" tag? Shouldn't it be "hpp"?
What is the reason you are putting the file into the source directory? Do you plan on adding it to your repository? Normally, build artifacts (no matter whether they are binaries or human-readable files) should be located inside the build directory as not to "pollute" the source tree.
You did not mention in what way the module does not work for you now, so it's hard to diagnose the problem. You should mention what you expected to happen and what happened instead (giving the concrete error message, if there is one).
I managed to make it work after digging a little more in the doc and source code, I share with you the working module.
This module when imported if there are any .rep files (QtRO (remote objects)) module remote object definition) in your project, it will invoke the repc compiler and compile them and put the resulting .h file in your source directory.
Still not complete, I didn't find a way to manipulate the files property of the Product Item to add the .h to it automatically.
import qbs
import qbs.FileInfo
Module {
FileTagger {
patterns: ["*.rep"]
fileTags: ["repc-rep"]
}
Rule {
inputs: ["repc-rep"]
Artifact {
filePath: repc_" + FileInfo.baseName(input.fileName) + "_source.h"
fileTags: ["cpp"]
}
prepare: {
var cmd = new Command();
cmd.description = "repc " + input.fileName;
cmd.program = "repc.exe"
cmd.arguments = ["-i", "rep", "-o", "source", input.filePath, output.filePath];
var cmd2 = new JavaScriptCommand();
cmd2.silent = true;
cmd2.sourceCode = function() {
File.copy(output.filePath, FileInfo.path(input.filePath) + "/" + output.fileName);
}
return [cmd, cmd2];
}
}
}
In order to this module to work, the repc.exe must be in your path.
Any suggestion are welcomed.

Cannot add task ':jettyRun' as a task with that name already exists

I am using gretty as my container for building my spring project . But when i issue the command gradle clean or gradle jettyRun ,i am getting the following problem
Cannot add task ':jettyRun' as a task with that name already exists.
PFB my build.gradle file
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'jetty' //too old, Jetty6, use gretty
apply plugin: 'org.akhikhl.gretty'
apply plugin: 'idea'
apply plugin: 'jacoco' //code coverage
def springVersion = "4.2.4.RELEASE"
def jdkVersion = 1.8
def junitVersion = "4.12"
def logbackVersion = "1.1.3"
def jclOverSlf4jVersion = "1.7.14"
def jstlVersion = "1.2"
def hamcrestVersion = "1.3"
def servletApiVersion = "3.1"
sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
repositories {
mavenLocal()
mavenCentral()
}
task wrapper(type: Wrapper) {
gradleVersion = '2.10'
}
configurations.all {
exclude group: "commons-logging", module: "commons-logging"
}
dependencies {
compile 'org.slf4j:jcl-over-slf4j:' + jclOverSlf4jVersion
compile 'ch.qos.logback:logback-classic:' + logbackVersion
compile 'org.springframework:spring-webmvc:' +springVersion
compile 'javax.servlet:jstl:' + jstlVersion
compile 'org.springframework:spring-test:' + springVersion
//exclude the build in hamcrest
testCompile('junit:junit:' + junitVersion) {
exclude group: 'org.hamcrest'
}
testCompile 'org.hamcrest:hamcrest-library:' + hamcrestVersion
//include in compile only, exclude in the war
providedCompile 'javax.servlet:javax.servlet-api:' + servletApiVersion
}
//Gretty
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty:+'
}
}
gretty {
//port = 9000
contextPath = 'loanSharks'
servletContainer = 'jetty9'
}
//For Eclipse IDE only
eclipse {
wtp {
component {
//define context path, default to project folder name
contextPath = 'loanSharks'
}
}
}
jacoco {
toolVersion = "0.7.5+"
reportsDir = file("$buildDir/reports/jacoco")
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
Even removes plugin: 'jetty', but I am being still with the error:
Execution failed for task ':jettyRun'.
Cannot call TaskInputs.property(String, Object) on task ':jettyRun' after task has started execution.

Browser Service don't work on android device

I have uses the Browser Service for Gluon charm down. But It not work. Someone can help me please? I don't have any Error . That is my Build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.1'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonapplication.GluonApplication'
dependencies {
compile 'com.gluonhq:charm:4.2.0'
androidRuntime 'org.sqldroid:sqldroid:1.0.3'
androidCompile 'org.glassfish:javax.json:1.0.4'
androidRuntime 'com.google.zxing:core:3.2.1'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.15.1'
compile group: 'org.sqldroid', name: 'sqldroid', version: '1.0.3'
compile group: 'com.gluonhq', name: 'charm-down-desktop', version: '0.0.2'
compile group: 'com.gluonhq', name: 'charm-down-common', version: '0.0.1'
compile group: 'com.gluonhq', name: 'charm-down-android', version: '0.0.1'
compileNoRetrolambda 'com.airhacks:afterburner.mfx:1.6.2'
compile group: 'com.gluonhq', name: 'charm-down-plugin-browser', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-barcode-scan-android', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-battery', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-dialer-android', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-pictures', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-position', version: '3.2.0'
}
jfxmobile {
downConfig {
version = '3.1.0'
plugins 'cache','display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
applicationPackage = 'org.javafxports.ensemble'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonapplication.**.*',
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*',
'ensemble.**.*'
]
}
}
and i have implemented the Service like so
public void browser() {
Services.get(BrowserService.class).ifPresent(service -> {
try {
service.launchExternalBrowser("www.google.com");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
});
}
After i add it in a Button to the Scene Builder
The Position and Barcode-Scan Plugin do not works also fine
Here is how i have implemented it.
public void position() {
Services.get(PositionService.class).ifPresent(service -> {
Position position = service.getPosition();
System.out.printf("Current position: %.5f, %.5f", position.getLatitude(), position.getLongitude());
LS4.setText(position.getLatitude() + " /" + position.getLongitude() + "");
});
}
public void barCode() {
Services.get(BarcodeScanService.class).ifPresent(service -> {
BarcodeScanService barcodeScanService = (BarcodeScanService) new BarcodeScanServiceFactory();
Optional<String> barcode = barcodeScanService.scan();
barcode.ifPresent(barcodeValue -> LS4.setText(barcodeValue));
});
}
and that is my androidmanifest
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gluonapplication" android:versionCode="1" android:versionName="1.0">
<supports-screens android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21"/>
<application android:label="MultiViewProjectFXML" android:name="android.support.multidex.MultiDexApplication" android:icon="#mipmap/ic_launcher">
<activity android:name="javafxports.android.FXActivity" android:labe
l="MultiViewProjectFXML" android:configChanges="orientation|screenSize">
Your build contains wrong dependencies, and the plugins should be managed by the downConfig configuration.
It will take care of adding the proper plugins and for the proper platform.
Modify your dependencies and plugins like this:
dependencies {
compile 'com.gluonhq:charm:4.3.0'
androidRuntime 'org.sqldroid:sqldroid:1.0.3'
androidCompile 'org.glassfish:javax.json:1.0.4'
androidRuntime 'com.google.zxing:core:3.2.1'
desktopCompile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.15.1'
desktopCompile group: 'org.sqldroid', name: 'sqldroid', version: '1.0.3'
compile 'com.airhacks:afterburner.mfx:1.6.3'
}
jfxmobile {
downConfig {
version = '3.2.0'
plugins 'barcode-scan', 'battery', 'browser', 'cache', 'dialer', 'display', 'lifecycle', 'picture', 'position', 'statusbar', 'storage'
}
}
As for the Browser service, you'll need to include http://.

Resources