Android studio 3.0 error inflating info.hoang8f.widget.fbutton - maven

After upgrading android studio form 2.3.3 to 3.0 it needs to add google maven repository and in my project an error appears in inflating info.hoang8f.widget.fbutton but before upgrading my project was working properly with FButton.
Also if I modified the build gradle to 2.3.3 the same problem still existed until I delete google maven repository form build script repositories and allprojects repositories then it works properly.
I am wondering what cause this problem?

For some odd reason compile 'info.hoang8f:fbutton:1.0.5' doesn't build. So I found this solution.
Download the library on the below link:
http://repo1.maven.org/maven2/info/hoang8f/fbutton/1.0.5/fbutton-1.0.5.aar
Step 1:
File >> New >> New Module >> Import JAR/AAR Package >> "Location of the downloaded library".
Step 2:
Ctr+Alt+Shift+S >> Click on the Dependencies tab >> Click the plus sign(+) >> 3 Module Dependencies >> Click Ok and Rebuild.
It should be fine afterwards, please let me know how it worked out for you.

I fixed it.
in build.gradle (Module:app) add this
dependencies {
implementation 'com.github.jd-alexander:android-flat-button:v1.1'
}
And add this in your root build.gradle (project:) at the end of repositories:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
And in the XML configuration change buttonColor to fButtonColor.
It works for me, I hope it works with you.
library source https://github.com/jd-alexander/android-flat-button

Related

Gradle Idea plugin - issues with specifing test sources

I'm trying to create a custom source set and mark its contents in Intellij Idea as a Test Sources Root. I tried to use idea plugin and do it according to the gradle official website but it is not clear for me how it works.
First of all the documentation specifies the following configuration setup
idea {
module {
testSources.from(sourceSets["intTest"].java.srcDirs)
}
}
When I try to use it i receive Unresolved reference: testSources. Where is it coming from?
Then I tried to use:
idea {
module {
testSourceDirs = intTest.java.srcDirs
}
}
it works fine as long as I use only Java. After applying Kotlin plugin however, both kotlin and java + resources folder are again treated as Sources Root not Test Sources. To fix that I had to change from:
testSourceDirs = intTest.java.srcDirs
to:
testSourceDirs = intTest.kotlin.srcDirs
and now all folders are Test Source Root again. Since kotlin.srcDirs also includes java.srcDirs it looks like you have to specify all, otherwise it is ignored...
Now the real issue came when I used gradle-avro-plugin. Applying it made my folders marked as Sources Root again. I believe it is because it adds another avro directory, but just to main source set.
Does anyone know how to make it marked as Test Sources having both kotlin and avro plugin applied? Am I doing something wrong here? Beacause this beheviour seems to be buggy in the first place.
Tested with:
IntelliJ IDEA 2022.3.1 (Ultimate Edition)
Gradle 6.8.3 and 7.4.2
Plugin id("com.github.davidmc24.gradle.plugin.avro") version "1.5.0"
Plugin kotlin("jvm") version "1.7.0"

Android-studio 3.5.1 Gradle ERROR: No value has been specified for property lottie-react-native

Upgraded android studio to 3.5.1. Took fresh checkout of project and gradle sync started failing. Searched everywhere but could not find any proper solution. In logs can see error at line 97 of lottie react native android gradle-maven-push.gradle
Have tried downgrading gradle version, android studio version as well but still same error.
Gradle task defined in gradle-maven-push.gradle
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath()
.join(File.pathSeparator))
}
Got it working by changing the code to
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath()
.join(File.pathSeparator)) + configurations.implementation
}
Reference: https://github.com/airbnb/lottie-android/blob/master/lottie/build.gradle
The difference is that of configuration.implementation between what is downloaded in lottie's react native module's build.gradle and and specified in github link.

Duplicate generated class gradle output (build/...) vs intellij output (out/...)

I'm using intellij (2019.1.1) for a java gradle (5.4.1) project and use lombok (1.18.6) for autogenerating code. Intellij puts generated sources under out/production/classes/generated/... and gradle puts them under build/generated/sources/...
This is fine, and I like that intellij keeps it's own build artifacts separate from gradles, however, intellij seems to look in both directories when running projects and it complains about the duplicate generated classes.
What is the best practice for using intellij with gradle and autogenerated sources? Do you:
tell intellij to output to the same directory as gradle (this
could lead to odd behaviour if a process outside of intellij updates
a file under build/)
tell intellij to perform all tasks with
gradle (i hear this is slower than intellij's make)
tell intellij
to simply ignore the 'build' directory (how do you even do this? and
why does intellij even care about 'build/' when it knows it outputs
to 'out/')
UPDATE: to clarify the situation, the issue is NOT with lombok autogenerated code, it is with hibernate-jpamodelgen. The problem remains the same (duplicate generated sources) but I want to clarify the it is the sources generated by jpamodelgen and not lombok.
UPDATE 2: I have tried the following configuration in an attempt to tell intellij where the generated sources live and also to tell intellij to ignore the build directory. Sadly, this did not work (still get duplicate class error on the generated source files).
apply plugin: 'idea'
idea {
module {
sourceDirs += file('out/production/classes/generated')
generatedSourceDirs += file('out/production/classes/generated')
excludeDirs += file('build')
}
}
UPDATE 3:
Tried the advice from M.Riccuiti and deleted build/, out/, .idea/, .gradle/ and reimported the gradle project but intellij is still seeing the generated sources in the build/ directory.
Here is an approach that finally worked for me. The trick is to notice that when gradle generates the classes, it puts them in:
build\generated\sources\annotationProcessor\java\main\com...
but intellij has the production sources directory set to "generated" in this case, the sources go to:
build\generated\sources\annotationProcessor\java\main\generated\com...
if you compile with gradle first and then use idea, you get both of them, which causes the problem!
To solve this, replace "generated" and "generated_test" in the intellij annotation processors "production sources directory " and "test sources directory " configuration with just a "/" this makes both gradle and intellij generate the sources in the SAME directory, overwriting each other as needed. Also make sure that the "store generated sources relative to" is set to "module content root" and REBUILD the application to clear out any other sources.
The solution I proposed in previous comment was working fine in IDEA 2018.3.x but after upgrading to IDEA 2019.1 I again got this duplicate class exception...
Below is a working solution to make this work with Gradle 5.x (tested with 5.4) and IDEA 2019.1 , to implement your solution #3 which I think is the best option (do not mix gradle & idea generated output directories, and do not delegate IDEA action do Gradle )
The key point is to use excludeDirs property from idea.module extension to make IDEA ignore generated sources managed by Gradle under build/generated/sources/...
ext {
// path to Gradle generated main sources directory
gradleGeneratedMainSourcesDir = "$buildDir/generated/sources/annotationProcessor/java/main/"
// path to Gradle generated test sources directory
gradleGeneratedTestSourcesDir = "$buildDir/generated/sources/annotationProcessor/java/test/"
// path to IDEA generated sources directory
ideaGeneratedSourcesDir = "$projectDir/out/production/classes/generated"
}
idea {
module {
// exclude main & test sources generated by Gradle from project source directories
excludeDirs += file(gradleGeneratedMainSourcesDir)
excludeDirs += file(gradleGeneratedTestSourcesDir)
// include generated sources directory managed by IDEA
sourceDirs += file(ideaGeneratedSourcesDir)
generatedSourceDirs += file(ideaGeneratedSourcesDir)
}
}
See complete sample project based on this configuration here : https://github.com/mricciuti/sample-springboot-gradle-idea
You can enter to IntelliJ Settings (Preferences):
Preferences | Build, Execution, Deployment | Build Tools | Gradle | Runner
Then you tick the checkbox Delegate IDE build/run action to Gradle
Finally, you clean and build again. The issues will be resolved.

Can't install Kontakt Android SDK using Gradle on Android Studio

I'm trying to install the Android SDK from Kontakt into a project in Android studio. I'm following the (seemingly basic) instructions on the Kontakt site here:
http://docs.kontakt.io/android-sdk/quickstart/#installing-the-sdk---android-studio
In brief, these steps say add maven { url 'http://repo.kontakt.io/repository/internal/' } in the repositories in your top-level build file, and add to add compile 'com.kontakt.sdk.android:library:1.0.5' in the dependencies in the main module build file.
However, when I try to sync my project with the updated files, it fails with an error message:
Error:Failed to find: com.kontakt.sdk.android:library:1.0.5
I tried with a totally fresh project and the same issue.
I'm guess this all has something to do with the fact that the instructions are written for Android's 0.12 version of the Gradle tools, but I'm using v1.1.0. I'm not across the detail of Gradle, so so any help would be appreciated.
My guess is that path to Kontakt.io public repository should be added to allprojects section instead of buildscript.
allprojects {
repositories {
jcenter()
maven { url 'http://repo.kontakt.io/repository/internal/' }
}
}
I am not 100% sure so don't shoot me:P
I think adding this line:
-->compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.kontakt.sdk.android:library:1.0.6'
Directly above the gradle project I wanted to compile fixed it.
Go to the Kontakt.io Android Proximity SDK https://github.com/kontaktio/kontakt-android-sdk on GitHub.
Click the Download ZIP button
Un-zip the file to a temporary location.
Add the jar file in your Android Studio Project.
File -> New Module -> Import .JAR/ .AAR Package -> Click Next -> Browse the SDK path (2.1.1) -> Finish (Take time to add in the project)
Then, Add module in dependencies
Right Click on Project Name -> Open Module Settings -> Under the list (Modules) -> Click on Dependencies -> Click on '+' -> Module Dependency -> Add Kontakt.io-android-sdk
Now Build your project It worked for me to kontakt io SDK. If anybody find the way to do this as Gradle build, please let me know.

Download the dependencies source code used at android studio

Now,google use android studio,i can add dependencies at build.gradle as follows:
dependencies {
compile 'mobi.parchment:parchment:1.6.9#aar'
}
but sometime i want to see the source code "mobi.parchment:parchment#aar",maybe i want to modify it or use to eclipse but not use the gradle plugin
If AndroidStudio didn't download the source code, you can force the download of source (and javadoc) of your AAR dependency by adding these lines in the build.gradle file :
dependencies {
compile 'mobi.parchment:parchment:1.6.9#aar'
compile 'mobi.parchment:parchment:1.6.9:sources#jar'
compile 'mobi.parchment:parchment:1.6.9:javadoc#jar'
}
Then on AndroidStudio in the Projet tab, expand the external Librarie and right clic on your lib (parchment1.6.9), click "Library Properties ..." and the "+" button. the source's jar file is in the gradle cache under ${user_Home}/.gradle/modules-2/files-2.1 directory; you can select it.
(Once is done you don't need anymore to declare the source dependencies; so your build.gradle can contain only :
dependencies {
compile 'mobi.parchment:parchment:1.6.9'
}
I know it's an ugly process, but it's the only workaround I found until now.

Resources