Unresolved reference: kotlinx - Kotlin 1-0-0-rc-1036 - android

I'm working in an Android App and a few days ago I updated my Kotlin version from 1.0.0-beta-1103 to the release candidate 1.0.0-rc-1036 and now I can't run my app for something related to Kotlin Android Extensions.
I use the apply plugin: 'kotlin-android-extensions' just like the official blog says http://blog.jetbrains.com/kotlin/2016/02/kotlin-1-0-release-candidate-is-out/ but my app doesn't recognize any view from any layout.
This is what appears on the console:
Error:(20, 8) Unresolved reference: kotlinx
Error:Execution failed for task ':app:compileDebugKotlin'.
Compilation error. See log for more details
Please help me, I'm losing my mind!
Update:
This is my buildScript in globalbuild.gradle
buildscript {
ext {
kotlin_version = "1.0.0-rc-1036"
}
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
The dependencies listed in the app build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Google
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
// Kotlin
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// Square
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
// ReactiveX
compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'com.jakewharton.rxbinding:rxbinding:0.3.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.2.0'
// DBFlow
kapt 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
compile "com.raizlabs.android:DBFlow-Core:2.2.1"
compile "com.raizlabs.android:DBFlow:2.2.1"
// Otros
compile 'de.hdodenhof:circleimageview:1.3.0'
// SQLite Assets Helper
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true
}
}
This is an import that I'm using:
import kotlinx.android.synthetic.main.activity_all_quizzes.*

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
should be defined in the project-local build.gradle file for now.

Your kotlin stdlib compile dependency should (at least while not stable) be the same as the kotlin android studio plugin version
...
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
...
buildscript {
ext.kotlin_version = '1.0.0-rc-1036'
...

Related

Getting error for Play services and Firebase version

In my app build.gradle I have this settings
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
}
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven {
url 'https://jitpack.io'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
}
ext {
supportlib_version = '26.0.2'
gps_version = '15.0.2'
}
And in my other gradle file I have integrated these libraries
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.devbrackets.android:exomedia:4.0.3'
//Radio
compile 'com.squareup.okhttp3:okhttp:3.3.1'
//WC
compile 'org.jsoup:jsoup:1.8.3'
compile 'com.onesignal:OneSignal:[3.6.0,4.0.0)'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.booking:rtlviewpager:1.0.1'
compile 'com.github.apg-mobile:android-round-textview:v0.0.3'
compile 'com.github.chrisbanes:PhotoView:1.3.0'
compile 'com.google.code.gson:gson:2.8.0'
//TV & Radio
compile "com.android.support:cardview-v7:$supportlib_version"
compile "com.android.support:appcompat-v7:$supportlib_version"
compile "com.android.support:recyclerview-v7:$supportlib_version"
compile "com.android.support:design:$supportlib_version"
compile "com.android.support:support-v4:$supportlib_version"
compile "com.android.support:support-core-utils:$supportlib_version"
compile "com.android.support:support-media-compat:$supportlib_version"
implementation 'com.google.firebase:firebase-messaging:15.0.2'
compile "com.google.android.gms:play-services-gcm:$gps_version"
compile "com.google.android.gms:play-services-ads:$gps_version"
}
Getting this error on build - Failed to resolve: com.google.android.gms:play-services-gcm:15.0.2
Install Repository and sync project
When I try to install its gives error that The repository could not be found
Please suggest what version should I use for proper build.
There is no 15.0.2 version of play-services-gcm now (see http://maven.google.com).
Also, your use of a $gps_version variable is now discouraged for this exact reason; Play services libraries will iterate at different release cycles with different versions. See the latest guidance: https://developers.google.com/android/guides/versioning#remove_old_anti_pattern

FirebaseApp: Firebase API initialization failure

I am facing an error caused by Firebase Api.
Here is error log:
Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
Caused by: java.lang.IllegalAccessError: tried to access method android.support.v4.content.ContextCompat.<init>:(Ljava/lang/String;)V from class com.google.firebase.iid.zzg
And here is my gradle:
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.google.gms:google-services:3.0.0'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services-appindexing:9.0.0'
compile 'com.google.android.gms:play-services-analytics:9.0.0'
}
What can it be the problem?
So it looks like the Firebase dependencies themselves depend on a specific version of the com.android.support libraries. I changed all of mine to 25.1.1 (found by Android Studio complaining about different versions) and that has fixed problem for me!
So for your build.gradle:
dependencies {
...
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.android.support:support-v4:25.1.1'
...
}
Edit: This is what Android Studio is complains about when I added Firebase
After I added firebase dependency and updated gms library versions this error is fixed.
My build.gradle:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.google.android.gms:play-services:10.2.1'
compile 'com.google.firebase:firebase-appindexing:10.2.1'
compile 'com.google.android.gms:play-services-analytics:10.2.1'
}
apply plugin: 'com.google.gms.google-services'

Google Play Services GCM

I try to add google analitics to my app but I get error in build.gradle:
Error: Execution failed for task ':app:mergeProductionDebugResources'.
\app\build\generated\res\google-services\production\debug\xml\global_tracker.xml: Error: Duplicate resources
but the wrong in my code:
This is my app level gradle
android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('src/main/java/libs/gson-2.2.4.jar')
compile files('src/main/java/libs/quickblox-android-sdk-chat-2.5.1.jar')
compile files('src/main/java/libs/quickblox-android-sdk-content-2.5.1.jar')
compile files('src/main/java/libs/quickblox-android-sdk-core-2.5.1.jar')
compile files('src/main/java/libs/quickblox-android-sdk-messages-2.5.1.jar')
compile files('src/main/java/libs/bugsense-3.5.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:design:23.+'
compile "com.splunk.mint:mint:5.0.0"
compile 'com.google.android.gms:play-services-analytics:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
}
and this is my project level gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
Edit:
when I remove global_tracker.xml
the runOnUiThread in:
import static com.google.android.gms.internal.zzir.runOnUiThread;
not know!!!
Remove the global_tracker.xml from your xml folder, as the google-services plugin will automatically add all the required data from the google-services.json configuration file when building your app.

How to instamojo integrated in android

Im new for android, I want to add payment option in my app. So, I used instamojo. Im include instamojo library in gradle file. But gradle file throw error.
Error:
Error:Failed to resolve: in.juspay:godel:0.6.11.0823
My gradle file:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.2.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.loopj.android:android-async-http:1.4.7'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
compile 'com.android.support:multidex:1.0.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.instamojo:android-sdk:1.2.4'
}
If i run the instamojo sdk in separate application means working perfectly.If i integrate with my app means getting above gradle error.
Please, anyone help to resolve.
Thanks in advance.
Error:Failed to resolve: in.juspay:godel:0.6.11.0823
From here or here
You should have an allprojects block, that contains some lines like this
// Add to build.gradle
repositories {
jcenter() // <-- should already be there
mavenCentral()
maven {
url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
}
And in app/build.gradle
dependencies {
// compile 'in.juspay:godel:0.6.12.0823' // maybe need this?
compile 'com.instamojo:android-sdk:1.2.4'
// your other dependencies
...
...
}
Also, this line needs not to be there. compile 'com.google.gms:google-services:3.0.0' It should be in the classpath of the buildscript dependencies block.
And 'com.android.support:design:23.1.1' should use 23.2.0 to match the other Android support versions.
Regarding "Manifest merger failed", you can search to find something similar, and start with removing this line, because it's redundant with the other dependencies.
compile 'com.android.support:support-v4:23.2.0'
// Add to build.gradle
repositories {
jcenter() // <-- should already be there
mavenCentral()
maven {
url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
}
then add this in your manifest file
<meta-data android:name="instamojo.orderauth.url"
android:value="ur website name/access_token.php"
/>

Configuring "build.gradle" for Kotlin module in Android Studio

I'm developing an app and I want to separate the Android specific logic from the business logic ( "immutable" logic and Android independent), so I created two modules:
app : Android specific code
domain : Business logic ( written in Kotlin )
I'm using this build.gradle file for the kotlin module
apply plugin: 'kotlin'
kapt {
generateStubs = true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
/* Annotations library */
provided 'org.glassfish:javax.annotation:10.0-b28'
kapt 'com.google.dagger:dagger-compiler:2.0.1'
/* Dagger 2 library */
compile 'com.google.dagger:dagger:2.0.1'
/* EventBus library */
compile 'de.greenrobot:eventbus:2.4.0'
/* JODA TIME - time and date library */
compile 'joda-time:joda-time:2.9.2'
/*Rx Kotlin*/
compile 'io.reactivex:rxkotlin:0.55.0'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.0.47-beta'
}
buildscript {
ext.kotlin_version = '1.0.1-2'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
repositories {
mavenCentral()
maven{ url "http://repository.jetbrains.com/all" }
}
Is this the correct way to configure the kotlin module?
PLUS: I'm getting a Gradle DSL method not found: 'provided()' error. How could I fix it?
Gradle doesn't have provided configuration by default. Instead it has compileOnly. So if you really want a dependency to be available only during compilation do the following:
compileOnly 'org.glassfish:javax.annotation:10.0-b28'

Categories

Resources