Android studio LoggedErrorException after update to 0.9.9 - gradle

I am having this error output since I updated Android Studio to actual version (0.9.9) from 0.8v...
I have Windows 8 and I tried to change:
classpath 'com.android.tools.build:gradle:1.0.0-rc2'
to:
classpath 'com.android.tools.build:gradle:1.0.0'
I did this change in my main build.gradle file and in build.gradle of facebook and pulltorefresh libraries in my project.
Also, in main build.gradle I changed:
buildTypes {
release {
runProguard false
proguardFile getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.release
}
}
to:
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.release
}
}
Obviusly, the project worked pefectly before update studio.
error (pastebin)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
}
signingConfigs {
release {
storeFile file('C:\\Trabajo\\Miguel\\TripTreat\\keystore-release.jks')
storePassword "storePassword"
keyAlias "keyAlias"
keyPassword "keyPassword"
}
}
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.release
}
}
productFlavors {
flavor1 {
proguardFile 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:4.0.+'
compile project (":TripTreat:libs:facebook")
compile project (":TripTreat:libs:pull_refresh")
}
dependencies{
compile files ('libs/ksoap2-android-assembly-3.1.0-jar-with-dependencies.jar',
'libs/gson-2.2.4.jar',
'libs/gson-2.2.4-javadoc.jar',
'libs/gson-2.2.4-sources.jar',
'libs/MobileAppTracker-3.2.2.jar')
}
I don't know how to use --stacktrace option....
Thank you all!!
EDIT: Studio updated to 1.0 and still happening the same.

Related

How to use .klib library in Kotlin/Multiplatform project

I want to use C code in my Kotlin/Multiplatform project (common level).
By this article:
https://theprogrammershangout.com/resources/kotlin/native/creating-c-bindings.md/
I got my .klib file and now I want to add it to my IntelliJ Kotlin/Multiplatform project.
I'm trying to add this to Gradle without success:
implementation files("/path/to/App.klib")
The project is built successfully but the importing App is not resolved.
What am I missing?
I already searched all over the internet and did not found anything helpful.
My build.gradle:
buildscript {
repositories {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.4.10'
id 'maven-publish'
}
apply plugin: 'com.android.library'
repositories {
mavenCentral()
google()
jcenter()
}
group 'com.texel.examples.kotlinnative'
version '0.0.1'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName '1.0'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
}
}
sourceSets {
main {
manifest.srcFile 'src/jvmMain/AndroidManifest.xml'
java.srcDirs = ['src/jvmMain/kotlin']
res.srcDirs = ['src/jvmMain/resources']
}
}
}
dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
kotlin {
// This is for iPhone emulator
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
// iosX64("ios") {
// binaries {
// framework()
// }
// }
macosX64("maccos") {
binaries {
framework()
}
}
android("android") {
// you can also publish both "release" and "debug"
publishLibraryVariants("release")
}
sourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9-native-mt"
implementation files("/Users/user/Downloads/App.klib")
}
}
jvmMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
}
}
jsMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-js'
}
}
macosMain {
dependencies {
}
}
iosMain {
dependencies {
}
}
}
}
configurations {
compileClasspath
}
Many thanks.
Here is the official documentation: C Interop and also an Using C Interop and libcurl for an App
(you may prefer to look at the https://github.com/JetBrains/kotlin-native/tree/master/samples/libcurl instead)
As I see the gradle setup is pretty different:
hostTarget.apply {
compilations["main"].cinterops {
val libcurl by creating {
when (preset) {
presets["macosX64"] -> includeDirs.headerFilterOnly("/opt/local/include", "/usr/local/include")
presets["linuxX64"] -> includeDirs.headerFilterOnly("/usr/include", "/usr/include/x86_64-linux-gnu")
presets["mingwX64"] -> includeDirs.headerFilterOnly(mingwPath.resolve("include"))
}
}
}

IntelliJ Kotlin multiplatform project Gradle sync very long

I've created a new Kotlin Multiplatform project for Andrid and iOS (Mobile shared Library). The project works fine but every time I run Gradle sync, it takes more than 5 minutes every time. It always get stuck on the same line:
Gradle: Build model 'org.jetbrains.kotlin.gradle.KotlinMPPGradleModel' for root project 'MyProject'
Why is it taking so long evey time?
I'm using Gradle version 5.1.
Here is my build.gradle file:
buildscript {
ext.kotlin_version = '1.3.11'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.8.1"
}
}
plugins {
id 'kotlin-multiplatform' version '1.3.11'
}
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
repositories {
mavenCentral()
}
group 'com.example'
version '0.0.1'
apply plugin: "com.android.library"
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName version
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions.incremental = false
}
kotlin {
targets {
fromPreset(presets.android, 'android')
// This preset is for iPhone emulator
// Switch here to presets.iosArm64 to build library for iPhone device
fromPreset(presets.iosX64, 'ios') {
compilations.main.outputKinds('FRAMEWORK')
}
}
sourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
}
}
commonTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-common'
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
}
}
androidMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
}
}
androidTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test'
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
}
}
iosMain {
}
iosTest {
}
}
}
configurations {
compileClasspath
}
Screenshot of the problem:
There's a known issue where Kotlin/Native dependencies are re-fetched every sync, which may be what you're seeing. You can see details and follow it here.
As posted to that issue, there's a workaround you may be able to try which essentially involves adding { content { excludeGroup("Kotlin/Native" } } to every item in your repositories block.
As #Brucelet pointed out this is a known issue. To supplement his answer, here is a full implementation of the workaround in Groovy:
repositories {
mavenCentral().content() {
excludeGroup "Kotlin/Native"
}
google().content() {
excludeGroup "Kotlin/Native"
}
jcenter() {
content {
excludeGroup("Kotlin/Native")
}
}
maven {
url 'https://jitpack.io'
content {
excludeGroup("Kotlin/Native")
}
}
}
and in Kotlin DSL:
repositories {
mavenLocal().apply {
content {
excludeGroup("Kotlin/Native")
}
}
maven {
url = uri("https://dl.bintray.com/soywiz/soywiz")
content {
includeGroup("com.soywiz")
excludeGroup("Kotlin/Native")
}
}
jcenter() {
content {
excludeGroup("Kotlin/Native")
}
}
google().apply {
content {
excludeGroup("Kotlin/Native")
}
}
}
Try to run the Gradle task from command lines with --parallel option.
Otherwise, fllow this guide to profile Gradle execution https://guides.gradle.org/performance/

android sdk app unfortunately stopped

.lang.NoSuchFieldError: No static field colorBackgroundFloating
this is my gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
}
}
apply(plugin: 'com.android.application')
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.kdu.routeP.app"
minSdkVersion 18
targetSdkVersion 23
versionCode 7
versionName "1.0.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
dexOptions {
javaMaxHeapSize "4g"
}
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'InvalidPackage'
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
// Crappy workaround to gradle build error when running instrumentation tests
// See: http://stackoverflow.com/questions/20827885/android-studio-0-4-duplicate-files-copied-in-apk-meta-inf-license-txt
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:support-annotations:23.0.1'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.afollestad.material-dialogs:core:0.9.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'com.yqritc:recyclerview-flexibledivider:1.2.5'
compile 'com.beardedhen:androidbootstrap:1.2.3'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2') {
// Necessary if your app targets Marshmallow (since Espresso
// hasn't moved to Marshmallow yet)
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile('com.android.support.test:runner:0.3') {
// Necessary if your app targets Marshmallow (since the test runner
// hasn't moved to Marshmallow yet)
exclude group: 'com.android.support', module: 'support-annotations'
}
compile 'com.google.android.gms:play-services:10.0.1'
}
sometimes I change the support library to 23.1.1 it works,but when it comes to the tabbed view it not working, and when I checked the external libraries it has the support 25.0.0

How do I link Gradle to a native Android library and solve 'could not find method externalNativeBuild()'?

I meet a problem when trying to build Telegram Source Code in Android Studio (https://github.com/DrKLO/Telegram).
I have installed NDK, CMake, LLDB.
But I got this error:
"Gradle sync failed: Could not find method externalNativeBuild()"
Here is my build.gradle:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
configurations {
compile.exclude module: 'support-v4'
}
dependencies {
compile 'com.google.android.gms:play-services-gcm:9.6.1'
compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'com.google.android.gms:play-services-vision:9.6.1'
compile 'com.android.support:support-core-ui:24.2.1'
compile 'com.android.support:support-compat:24.2.1'
compile 'com.android.support:support-core-utils:24.2.1'
compile 'net.hockeyapp.android:HockeySDK:4.0.1'
compile 'com.googlecode.mp4parser:isoparser:1.0.6'
}
android {
compileSdkVersion 24
buildToolsVersion '24.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig.applicationId = "org.telegram.messenger"
sourceSets.main.jniLibs.srcDirs = ['./jni/']
externalNativeBuild {
ndkBuild {
path "/jni/Android.mk"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
signingConfigs {
debug {
storeFile file("config/release.keystore")
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
release {
storeFile file("config/release.keystore")
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
buildTypes {
debug {
debuggable true
jniDebuggable true
signingConfig signingConfigs.debug
applicationIdSuffix ".beta"
}
release {
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
foss {
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
}
}
defaultConfig.versionCode = 851
sourceSets.debug {
manifest.srcFile 'config/debug/AndroidManifest.xml'
}
sourceSets.release {
manifest.srcFile 'config/release/AndroidManifest.xml'
}
sourceSets.foss {
manifest.srcFile 'config/foss/AndroidManifest.xml'
}
productFlavors {
x86 {
ndk {
abiFilter "x86"
}
versionCode = 2
}
armv7 {
ndk {
abiFilter "armeabi-v7a"
}
versionCode = 1
}
fat {
versionCode = 3
}
}
applicationVariants.all { variant ->
def abiVersion = variant.productFlavors.get(0).versionCode
variant.mergedFlavor.versionCode = defaultConfig.versionCode * 10 + abiVersion;
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 24
versionName "3.13.1"
externalNativeBuild { ndkBuild {
arguments "NDK_APPLICATION_MK:=jni/Application.mk", "APP_PLATFORM:=android-14"
abiFilters "armeabi-v7a", "x86"
}
}
}
}
apply plugin: 'com.google.gms.google-services'
It seems the Gradle has not linked to exist C++ library yet.
But, I didn't know how I manual link Gradle to exist Android.mk.
Any ideas?
A few guesses:
Make sure you are using ndk-r12 or ndk-r13 (check your local.properties file). After you change ndk version, rm -fr TMessagesProj/.externalNativeBuild [this is needed for current android studio]
The only connection between gradle and native code is your top level Android.mk which is there already, just change its path to 'jni/Android.mk' [it needs to be relative path to your $project/build.gradle file.
maybe jniLibs.srcDirs line in your build.gradle is not needed: the shared lib will be automatically packed into APK, unless you have other purposes. The built native libs are not saved there
I did have cmake installed, not sure that matters. https://developer.android.com/studio/projects/add-native-code.html. Your project could build with my fake json file, so your system should be pretty close.

AndroidStudio says Error:Execution failed for task ':app:processDebugResources'

I get the following error, while compiling / building my app with AndroidStudio 1.4:
Error:Execution failed for task ':app:processDebugResources'.>
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'/home/pepperonas/Android/Sdk/build-tools/23.0.2/aapt'' finished with
non-zero exit value 1
Who knows what causes this issue? I spent a lot of time trying different gradle versions and configurations, but the error is raised again.
This is how my gradle looks like:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
flatDir { dirs 'libs' }
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/amulyakhare/maven" }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
defaultConfig {
applicationId "com.pepperonas.teds"
minSdkVersion 16
targetSdkVersion 23
versionCode 19
versionName "0.2.9b"
multiDexEnabled true
project.ext.set("archivesBaseName", "teds");
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = outputFile.name.replace(".apk", "-" + defaultConfig.versionName + ".apk");
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/pass-v1.1.1.jar')
compile files('libs/sdk-v1.0.0.jar')
compile(name: 'aesprefs-0.0.5', ext: 'aar')
compile(name: 'andcommon-0.0.5', ext: 'aar')
compile 'com.android.support:multidex:1.0.1'
compile('com.afollestad.material-dialogs:core:0.8.0.1#aar') {
transitive = true
}
compile('com.afollestad.material-dialogs:commons:0.8.0.1#aar') {
transitive = true
}
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'com.mikepenz:iconics-core:1.7.6#aar'
compile 'com.mikepenz:google-material-typeface:1.2.0.1#aar'
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1#aar'
compile 'com.mikepenz:octicons-typeface:3.0.0.1#aar'
compile 'com.mikepenz:community-material-typeface:1.2.64.1#aar'
compile 'com.melnykov:floatingactionbutton:1.2.0'
compile 'com.github.clans:fab:1.6.1'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
}
Got it. The issue comes from the two FAB-libraries I added to the project.
compile 'com.melnykov:floatingactionbutton:1.2.0'
compile 'com.github.clans:fab:1.6.1'
I guess some resources are named the same ("duplicate").

Resources