Cause: org.gradle.api.internal.artifacts.DefaultModuleVersionSelector - intellij-idea

cant import gradle project in intellij idea
Cause: org.gradle.api.internal.artifacts.DefaultModuleVersionSelector
I couldn't build the project through terminal also.Error in terminal is:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':commons:compileJava'.
Compilation failed;
gradle file:
buildscript {
repositories {
mavenCentral()
// maven { url "${artifactoryRepoUrl}" }
jcenter()
} ext {
springBootVersion = '1.4.2.RELEASE'
commonsVersion = '0.4.3'
recruiterVersion = '0.2.6'
jobseekerVersion = '0.1.9'
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE")
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'org.springframework.boot'
apply plugin: 'maven-publish'
repositories {
mavenLocal()
mavenCentral()
// maven { url "${artifactoryRepoUrl}" }
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
springCloudVersion = '1.1.2.RELEASE'
springSecurityVersion = '4.1.1.RELEASE'
springRedisVersion = '1.7.2.RELEASE'
jedisVersion = '2.7.2'
log4jVersion = '2.6.2'
jacksonVersion = '2.8.1'
apacheCommonsVersion = '2.4.2'
lombokVersion = '1.16.10'
jnaVersion = '3.0.9'
jestVersion = '2.0.3'
beanutilsVersion = '1.9.2'
jwtVersion = '0.6.0'
springAWSVersion = '1.1.0.RELEASE'
mysqlConnectorVersion = '6.0.3'
springJDBCVersion = '4.3.2.RELEASE'
dbcpVersion = '2.1.1'
springCloudAWSVersion = '1.0.4.RELEASE'
elasticClientVersion = '5.0.2'
swaggerVersion = '2.4.0'
jose4jVersion = '0.5.4'
}
configurations.all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'org.springframework.boot', module: 'logback-classic'
}
}

try changing gradle file like :
buildscript {
ext {
springBootVersion = '1.4.2.RELEASE'
commonsVersion = '0.4.3'
recruiterVersion = '0.2.6'
jobseekerVersion = '0.1.9'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE")
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
}
}
subprojects {
...

Try to remove the following line:
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"

Related

Kotlin lowercase Function

I am new to kotlin, so I am sorry in advance, if this is a simple misstake.
I am trying at the moment to rewrite an api (written in Kotlin) to java 17.
Everything worked so far. But now I am getting following deprecated message:
'toLowerCase(): String' is deprecated. Use lowercase() instead.
Of course I know what it means, so I tried doing it like in the following Picture:
https://i.stack.imgur.com/vT8k5.png
But why doesnt it find the lowercase Function?
This is in my build.gradle:
plugins {
id 'org.jetbrains.kotlin.jvm'
id "org.jetbrains.kotlin.kapt"
id "org.jetbrains.dokka"
id "java-library"
id "maven-publish"
id "jacoco"
id "io.gitlab.arturbosch.detekt"
id "org.jlleitschuh.gradle.ktlint"
id "com.github.gmazzo.buildconfig"
}
apply from: "${rootDir}/gradle/dependencies.gradle"
tasks.withType(org.jetbrains.dokka.gradle.DokkaTask).configureEach {
dokkaSourceSets {
configureEach {
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(uri("").toURL())
}
externalDocumentationLink { url.set(new URL("https://square.github.io/retrofit/2.x/retrofit/")) }
externalDocumentationLink { url.set(new URL("https://square.github.io/okhttp/3.x/okhttp/")) }
externalDocumentationLink { url.set(new URL("https://square.github.io/moshi/1.x/moshi/")) }
}
}
}
tasks.dokkaJavadoc.configure {
outputDirectory.set(javadoc.destinationDir)
}
task sourceJar(type: Jar) {
archiveClassifier = "sources"
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier = "javadoc"
from javadoc.destinationDir
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "17"
allWarningsAsErrors = true
freeCompilerArgs = ["-Xjsr305=strict", "-progressive"]
}
}
kapt {
useBuildCache = true
}
test {
finalizedBy jacocoTestReport
useJUnitPlatform()
}
buildConfig {
packageName("my.package") // forces the package. Defaults to '${project.group}'
useKotlinOutput() // adds `internal` modifier to all declarations
buildConfigField("String", "packageName", "\"my.package\"")
buildConfigField("String", "version", provider { "\"${project.version}\"" })
}
jacoco {
setToolVersion(jacocoVersion)
}
jacocoTestReport {
reports {
xml.required = true
html.required = false
}
}
ktlint {
disabledRules = ["import-ordering"]
version = ktlintVersion
reporters {
reporter "checkstyle"
}
}
detekt {
version = detektVersion
buildUponDefaultConfig = true
config = files("$rootDir/config/detekt.yml")
}
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
compileKotlin {
kotlinOptions {
jvmTarget = "17"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "17"
}
}
Ensure your kotlin-stdlib version is 1.5 or above. Check this out

Can not ready file text within build.gradle.kts

I am trying to print a kotlin class before compiling it to generate another class. I tried many methods to be sure about printing the file text before compiling it through File.readText() but nothings success-ed always printing code joined with symbols as the following screenshot.
My Gradle code
tasks.findByName("compileKotlin")
?.dependsOn(tasks.register("compileKotlin2") {
doFirst {
var names2 = "filesPath= "
fileTree("$buildDir\\classes\\kotlin\\main\\tech\\example\\ecommerce\\ecommerce\\controller\\")
.visit {
if (this.file.name != "WebPagesController.class") {
names2 += this.file.path + "\n"
println(file(this.file.path).readText())
}
}
println(names2)
}
})
Full build.gradle.kts
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("plugin.jpa") version "1.3.61"
id("org.springframework.boot") version "2.2.5.RELEASE"
id("io.spring.dependency-management") version "1.0.9.RELEASE"
kotlin("jvm") version "1.3.61"
kotlin("plugin.spring") version "1.3.61"
}
group = "tech.example.ecommerce"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
// springframework
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-mail")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("mysql:mysql-connector-java")
// kotlin
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// testing
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
}
}
tasks.findByName("compileKotlin")
?.dependsOn(tasks.register("compileKotlin2") {
doFirst {
println("hiiiiiiiii")
var names2 = "a= "
fileTree("$buildDir\\classes\\kotlin\\main\\tech\\example\\ecommerce\\ecommerce\\controller\\")
.visit {
if (this.file.name != "WebPagesController.class") {
names2 += this.file.path + "\n"
println(file(this.file.path).readText())
}
}
println(names2)
}
})
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}
Any hints are welcomed, Thanks in advance
In fileTree("$buildDir\\classes\\kotlin\\main\\tech\\example\\ecommerce\\ecommerce\\controller\\")
using projectDir instead of buildDir with syntax
fileTree("$projectDir/src/main/kotlin/tech/example/ecommerce/ecommerce/controller") s

TypeError: undefined is not an object (evaluating 'o.NetInfo.isConnected')

I have a trouble with launching my app.. Tried everything that I found in similar topics, but still no success :(
I use:
Android Studio 3.5.3
Gradle Version 6
react-native-cli: 2.0.1
react-native: 0.61.5
I successfully migrated to Androidx using jetifier (I hope so)
#react-native-community/netinfo version is 5.5.0
build.grandle:
buildscript {
repositories {
google()
jcenter()
maven { url("$rootDir/../node_modules/jsc-android/dist") }
maven { url 'https://maven.fabric.io/public' }
maven { url "https://repo.gradle.org/gradle/repo" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'org.codehaus.groovy:groovy-all:2.4.15'
classpath 'io.fabric.tools:gradle:1.28.1'
}
}
allprojects {
repositories {
mavenLocal()
maven { url ("$rootDir/../node_modules/react-native/android") }
maven { url("$rootDir/../node_modules/jsc-android/dist") }
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
google()
jcenter()
}
}
ext {
compileSdkVersion = 28
targetSdkVersion = 28
minSdkVersion = 16
buildToolsVersion = "29.0.3"
//androidXCore = "1.0.2"
supportLibVersion="28.0.0"
googlePlayServicesVersion = "15.0.1"
googlePlayServicesVisionVersion = "17.0.2"
androidMapsUtilsVersion = "0.5+"
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core' &&
!details.requested.name.contains('androidx')) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "28.+"
}
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex') && !details.requested.name.contains('play-services-stats')) {
details.useVersion "12.+"
}
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex') && details.requested.name.contains('play-services-stats')) {
details.useVersion "+"
}
}
}
}
}
settings.gradle
rootProject.name = 'modelalliance_client'
include ':react-native-reanimated'
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-share'
project(':react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share/android')
include ':react-native-fetch-blob'
project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android')
include ':react-native-camera'
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
include ':rn-fetch-blob'
project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-touch-id'
project(':react-native-touch-id').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-touch-id/android')
include ':react-native-pdf'
project(':react-native-pdf').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-pdf/android')
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-document-picker'
project(':react-native-document-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-picker/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
include ':react-native-image-resizer'
project(':react-native-image-resizer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-resizer/android')
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':#react-native-community-netinfo'
project(':#react-native-community-netinfo').projectDir = new File(rootProject.projectDir, '../node_modules/#react-native-community/netinfo/android')
include ':app'
app/build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
def useIntlJsc = false
project.ext.react = [
entryFile: "index.js",
jsBundleDirRelease: "$buildDir/intermediates/merged_assets/release/out",
enableHermes: true,
hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermes",
bundleInStaging: true, // Add this
bundleInInternalTest: true, // Add this
bundleInRelease: true
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false)
android {
compileSdkVersion 28
buildToolsVersion '29.0.3'
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/INDEX.LIST'
exclude("META-INF/*.kotlin_module")
}
defaultConfig {
applicationId "com.modelalliance_client"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
// abiFilters "armeabi-v7a", "x86"
}
missingDimensionStrategy 'react-native-camera', 'general'
}
packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
project.ext.sentryCli = [
logLevel: "debug",
flavorAware: false,
//add
enableHermes: false
]
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
splits {
abi {
reset()
enable true
universalApk false // If true, also generate a universal APK
include "armeabi-v7a","arm64-v8a","x86","x86_64"
exclude "ldpi", "xxhdpi", "xxxhdpi"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
shrinkResources enableSeparateBuildPerCPUArchitecture
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
debug{ minifyEnabled enableProguardInReleaseBuilds
shrinkResources enableSeparateBuildPerCPUArchitecture
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release }
all {minifyEnabled enableProguardInReleaseBuilds
shrinkResources enableSeparateBuildPerCPUArchitecture
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
signingConfig signingConfigs.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, "arm64-v8a":3,"x86_64":4]
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 {
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.1'
implementation project(':react-native-reanimated')
implementation 'org.codehaus.groovy:groovy-all:2.4.15'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
if (useIntlJsc) {
implementation 'org.webkit:android-jsc-intl:+'
} else {
implementation 'org.webkit:android-jsc:+'
}
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-share')
implementation project(':rn-fetch-blob')
implementation project(':react-native-fs')
implementation project(':react-native-image-resizer')
implementation project(':react-native-image-picker')
implementation project(':react-native-touch-id')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-pdf')
implementation project(':react-native-vector-icons')
implementation project(':react-native-document-picker')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-firebase')
implementation project(':#react-native-community-netinfo')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.github.dhaval2404:imagepicker-support:1.5'
implementation 'androidx.arch.core:core-runtime:2.1.0'
implementation 'androidx.arch.core:core-common:2.1.0'
implementation "org.webkit:android-jsc:r241213"
implementation 'androidx.appcompat:appcompat:1.2.0-alpha02'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha03'
implementation "com.google.firebase:firebase-storage:19.1.1"
implementation "com.google.firebase:firebase-database:19.2.1"
implementation "com.google.firebase:firebase-dynamic-links:19.0.0"
implementation "com.google.firebase:firebase-invites:17.0.0"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.core:core:1.1.0'
implementation "com.facebook.react:react-native:0.61.5" // From node_modules
implementation(project(':react-native-camera')) {
exclude group: 'com.google.android.gms'
implementation ('com.google.android.gms:play-services-vision:15.0.1') {
force = true
}
}
implementation('com.google.android.gms:play-services-vision:19.0.0')
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:17.1.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation "com.google.android.gms:play-services-gcm:17.0.0"
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-firestore:21.4.0'
implementation "com.google.firebase:firebase-database:19.2.1"
implementation 'com.google.guava:guava:27.0.1-android'
implementation 'androidx.leanback:leanback:1.1.0-alpha03'
compile('com.google.guava:guava-jdk5:17.0') { force = true }
implementation 'org.gradle:gradle-core:2.2.1'
implementation(project(':react-native-camera')) {
exclude group: "com.google.android.gms"
compile ('com.google.android.gms:play-services-vision:15.0.1') {
force = true
}
}
implementation 'androidx.annotation:annotation:1.1.0'
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/"
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
implementation 'com.google.android.gms:play-services-base:17.1.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.google.android.gms:play-services-awareness:18.0.0'
implementation 'com.google.android.gms:play-services-cast:18.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.firebase:firebase-core:17.2.2'
implementation 'com.google.firebase:firebase-iid:20.0.2'
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'android.arch.work:work-runtime:1.0.1'
implementation 'com.android.support:multidex:1.0.3'
apply plugin: 'com.google.gms.google-services'
}
configurations {
all*.exclude group: 'com.google.guava', module:'guava-jdk5'
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
android.useDeprecatedNdk=true
MYAPP_RELEASE_STORE_FILE=divo.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=Glaz5756523
MYAPP_RELEASE_KEY_PASSWORD=Glaz5756523
org.gradle.jvmargs=-Xmx4608m
android.jetifier.blacklist = your-troublemaker-library.jar

error when import kotlin project android studio 3.5.3

I try to import project
i get this error when import project in android studio 3.5.3
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
and this error
This version of Android Studio cannot open this project, please retry with Android Studio 3.6 or newer
import org.jetbrains.kotlin.config.KotlinCompilerVersion
plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
}
// https://stackoverflow.com/a/52441962
fun String.runCommand(
workingDir: File = File("."),
timeoutAmount: Long = 60,
timeoutUnit: TimeUnit = TimeUnit.SECONDS
): String? = try {
ProcessBuilder("\\s".toRegex().split(this))
.directory(workingDir)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start().apply { waitFor(timeoutAmount, timeoutUnit) }
.inputStream.bufferedReader().readText()
} catch (e: java.io.IOException) {
e.printStackTrace()
null
}
android {
compileSdkVersion(29)
buildToolsVersion("29.0.2")
viewBinding.isEnabled = true
val gitVersion = listOf(
"git rev-parse --abbrev-ref HEAD",
"git rev-list HEAD --count",
"git rev-parse --short HEAD"
).joinToString("-") { it.runCommand()?.trim() ?: "" } +
(if (("git status -s".runCommand() ?: "").isBlank()) "" else "-dirty")
defaultConfig {
applicationId = "com.test.cale"
minSdkVersion(15)
targetSdkVersion(29)
versionCode = 621
versionName = "6.2.1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
resConfigs("en", "fa", "ckb", "ar", "ur", "ps", "glk", "azb", "ja")
setProperty("archivesBaseName", "PersianCalendar-$versionName-$gitVersion")
}
signingConfigs {
create("nightly") {
storeFile = rootProject.file("nightly.keystore")
storePassword = "android"
keyAlias = "androiddebugkey"
keyPassword = "android"
}
}
buildTypes {
create("nightly") {
signingConfig = signingConfigs.getByName("nightly")
versionNameSuffix = "-${defaultConfig.versionName}-$gitVersion-nightly"
applicationIdSuffix = ".nightly"
isMinifyEnabled = true
isShrinkResources = true
}
getByName("debug") {
versionNameSuffix = "-${defaultConfig.versionName}-$gitVersion"
applicationIdSuffix = ".debug"
}
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
// Maybe proguard-android-optimize.txt in future
// setProguardFiles(listOf(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"))
}
}
}
dependencies {
implementation(project(":equinox"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${KotlinCompilerVersion.VERSION}")
implementation("androidx.appcompat:appcompat:1.1.0")
implementation("androidx.preference:preference-ktx:1.1.0")
implementation("androidx.recyclerview:recyclerview:1.1.0")
implementation("androidx.cardview:cardview:1.0.0")
implementation("androidx.viewpager2:viewpager2:1.0.0")
implementation("com.google.android.material:material:1.1.0-rc02")
implementation("com.google.android:flexbox:1.1.0")
implementation("com.google.android.apps.dashclock:dashclock-api:2.0.0")
val navVersion = "2.1.0"
implementation("androidx.navigation:navigation-fragment-ktx:$navVersion")
implementation("androidx.navigation:navigation-ui-ktx:$navVersion")
implementation("androidx.core:core-ktx:1.1.0")
implementation("androidx.fragment:fragment-ktx:1.1.0")
implementation("androidx.activity:activity-ktx:1.0.0")
implementation("androidx.browser:browser:1.0.0")
implementation("androidx.work:work-runtime-ktx:2.2.0")
// debugImplementation("com.squareup.leakcanary:leakcanary-android:2.0-alpha-2")
// debugImplementation("com.github.pedrovgs:lynx:1.1.0")
testImplementation("junit:junit:4.12")
androidTestImplementation("androidx.test:runner:1.2.0")
androidTestImplementation("androidx.test:rules:1.2.0")
androidTestImplementation("androidx.test.espresso:espresso-contrib:3.2.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0")
}
please resolve the problem
Top-level Project Gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.6.0-rc01")
classpath(kotlin("gradle-plugin", version = "1.3.61"))
}
}
allprojects {
repositories {
google()
jcenter()
maven("https://jitpack.io")
}
}
task("clean") {
delete(rootProject.buildDir)
}

Add ViewPagerIndicator to project

In general such a problem trying to add ViewPagerIndicator the project.
Gradle: Execution failed for task ':SherlockTest:dexDebug'.
> Running D:\Programs\AS\sdk\build-tools\android-4.2.2\dx.bat failed. See output
depending:
SherlockTestProject
settings.gradle
include ':SherlockTest'
include ':libraries:ViewPagerIndicator'
include ':libraries:ActionBarSherlock'
SherlockTest
build.grandle
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile project(':libraries:ActionBarSherlock')
compile project(':libraries:ViewPagerIndicator')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
libraries\ActionBarSherlock
build.grandle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/android-support-v13.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
libraries\ViewPagerIndicator
build.grandle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/android-support-v13.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
Since viewpagerindicator uses Maven, we should be able to include it like any maven project. Also, on maven, they have a tab for gradle projects. Link to project on maven page
I am starting to write an app using this as well, so we will see how it goes.
In your build.gradle,
dependencies{
...
compile 'com.viewpagerindicator:parent:2.4.1'
}