By continuing you indicate that you have read and agree to our Terms of service and Privacy policy
by google Java Version: 31.1-jre License: Apache-2.0
by google Java Version: 31.1-jre License: Apache-2.0
Support
Quality
Security
License
Reuse
kandi has reviewed guava and discovered the below as its top functions. This is intended to give you an instant insight into guava implemented functionality, and help decide if they suit your requirements.
Get all kandi verified functions for this library.
Get all kandi verified functions for this library.
Google core libraries for Java
See all related Code Snippets
QUESTION
Dart Flutter FAILURE: Build failed with an exception. Error
Asked 2022-Mar-23 at 08:45I took a few steps to publish my app on Play Store. Since making them, I've been getting errors when converting codes to APK.
I did the steps here: https://docs.flutter.dev/deployment/android#configure-signing-in-gradle
Error:
PS C:\Users\emiry\Desktop\KelimeOgren\kelimeogrenmeuygulamasi> flutter build appbundle
Building with sound null safety
FAILURE: Build failed with an exception.
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BU�LD FAILED in 3s
Running Gradle task 'bundleRelease'... 4,8s
Gradle task bundleRelease failed with exit code 1
storePassword=secure
keyPassword=secure
keyAlias=key
storeFile=/key.jks
android/app/build.gradle:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.example.secureAppId"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.firebase:firebase-analytics:19.0.2'
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation platform("com.google.firebase:firebase-bom:29.2.1")
}
android/build.gradle:
buildscript {
ext.kotlin_version = '1.5.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I will publish the app on Google Play Store. https://docs.flutter.dev/deployment/android#configure-signing-in-gradle I did the ones in this link.
What is the problem? How can I solve it? Thank you very much in advance for the help.
ANSWER
Answered 2022-Mar-22 at 22:25Put both key.properties
and key.jks
files directly to the android
folder , not inside src
. And, in the key.properties
file, do the following:
storePassword=secure
keyPassword=secure
keyAlias=key
storeFile=../key.jks
QUESTION
android datastore-preferences: Property delegate must have a 'getValue(Context, KProperty<*>)' method
Asked 2022-Feb-28 at 12:19I'm writing a jetpack compose android app, I need to store some settings permanently.
I decided to use androidx.datastore:datastore-preferences:1.0.0
library, I have added this to my classpath.
According to the https://developer.android.com/topic/libraries/architecture/datastore descripton I have added this line of code to my kotline file at the top level:
val Context.prefsDataStore: DataStore by preferencesDataStore(name = "settings")
But I get a compile error:
e: ...SettingsViewModel.kt: (13, 50): Property delegate must have a 'getValue(Context, KProperty<*>)' method. None of the following functions is suitable:
public abstract operator fun getValue(thisRef: Context, property: KProperty<*>): DataStore<Preferences> defined in kotlin.properties.ReadOnlyProperty
How can I use the datastore-preferences?
My build.gradle file:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
}
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'kotlinx-serialization'
android {
compileSdk 31
defaultConfig {
applicationId "hu.homedashboard.mobile"
minSdk 22
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
useIR = true
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion "$kotlinVersion"
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation "androidx.activity:activity-compose:1.3.1"
implementation "androidx.appcompat:appcompat:1.3.1"
implementation "androidx.datastore:datastore-preferences:1.0.0"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "com.google.accompanist:accompanist-swiperefresh:0.20.3"
implementation "androidx.core:core-ktx:1.6.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.navigation:navigation-compose:2.4.0-alpha10"
implementation "com.google.android.material:material:1.4.0"
implementation "com.google.dagger:hilt-android:2.40.1"
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0"
implementation "org.ocpsoft.prettytime:prettytime:5.0.2.Final"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'
kapt "com.google.dagger:hilt-compiler:2.38.1"
kapt "com.google.dagger:dagger-android-processor:2.40.1"
kapt "com.google.guava:guava:31.0.1-android"
api "com.google.guava:guava:31.0.1-android"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}
kapt {
correctErrorTypes true
javacOptions {
option("-Xmaxerrs", 500)
}
}
ANSWER
Answered 2022-Jan-13 at 09:20I got this error because of an incorrect import:
import java.util.prefs.Preferences
So fix it by
import androidx.datastore.preferences.core.Preferences
or
val Context.dataStore by preferencesDataStore(name = "settings")
QUESTION
android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify
Asked 2022-Feb-23 at 14:13After upgrading to android 12, the application is not compiling. It shows
"Manifest merger failed with multiple errors, see logs"
Error showing in Merged manifest:
Merging Errors: Error: android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for
android:exported
when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. main manifest (this file)
I have set all the activity with android:exported="false"
. But it is still showing this issue.
My manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.siacs.conversations">
<uses-sdk tools:overrideLibrary="net.ypresto.androidtranscoder" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-feature
android:name="android.hardware.location"
android:required="false" />
<uses-feature
android:name="android.hardware.location.gps"
android:required="false" />
<uses-feature
android:name="android.hardware.location.network"
android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<application
android:name=".Application"
android:allowBackup="false"
android:allowClearUserData="true"
android:appCategory="social"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_app_launch"
android:label="@string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_configuration"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_app_launch_round"
android:theme="@style/ConversationsTheme"
android:usesCleartextTraffic="true"
android:windowSoftInputMode="adjustPan|adjustResize"
tools:replace="android:label"
tools:targetApi="q">
<activity
android:name=".ui.search.GroupSearchActivity"
android:exported="true" />
<activity
android:name=".ui.profileUpdating.FavouritesActivity"
android:exported="true" />
<activity
android:name=".ui.profileUpdating.NameActivity"
android:exported="true" />
<activity
android:name=".ui.CompulsoryUpdateActivity"
android:exported="true" />
<activity android:name=".ui.payments.doPayment.DoPaymentActivity"
android:exported="true" />
<activity android:name=".ui.individualList.IndividualListActivity"
android:exported="true" />
<activity android:name=".ui.payments.setPayment.SetPaymentActivity"
android:exported="true" />
<activity android:name=".ui.login.otpActivity.OTPActivity"
android:exported="true" />
<activity android:name=".ui.login.loginActivity.LoginActivity"
android:exported="true" />
<service android:name=".services.XmppConnectionService" android:exported="true" />
<receiver android:name=".services.EventReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
<action android:name="android.media.RINGER_MODE_CHANGED" />
</intent-filter>
</receiver>
<activity
android:name=".ui.ShareLocationActivity"
android:label="@string/title_activity_share_location"
android:exported="true"/>
<activity
android:name=".ui.SearchActivity"
android:label="@string/search_messages"
android:exported="true" />
<activity
android:name=".ui.RecordingActivity"
android:configChanges="orientation|screenSize"
android:theme="@style/ConversationsTheme.Dialog"
android:exported="true" />
<activity
android:name=".ui.ShowLocationActivity"
android:label="@string/title_activity_show_location"
android:exported="true" />
<activity
android:name=".ui.SplashActivity"
android:theme="@style/SplashTheme"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.ConversationsActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:minWidth="300dp"
android:minHeight="300dp"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.ScanActivity"
android:screenOrientation="portrait"
android:exported="true"
android:theme="@style/ConversationsTheme.FullScreen"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".ui.UriHandlerActivity"
android:label="@string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="xmpp" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="im.app.in" />
<data android:pathPrefix="/i/" />
<data android:pathPrefix="/j/" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="imto" />
<data android:host="jabber" />
</intent-filter>
</activity>
<activity
android:name=".ui.StartConversationActivity"
android:label="@string/title_activity_start_conversation"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".ui.SettingsActivity"
android:label="@string/title_activity_settings"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
</intent-filter>
</activity>
<activity
android:name=".ui.ChooseContactActivity"
android:label="@string/title_activity_choose_contact"
android:exported="true" />
<activity
android:name=".ui.BlocklistActivity"
android:label="@string/title_activity_block_list"
android:exported="true"/>
<activity
android:name=".ui.ChangePasswordActivity"
android:label="@string/change_password_on_server"
android:exported="true"/>
<activity
android:name=".ui.ChooseAccountForProfilePictureActivity"
android:enabled="false"
android:label="@string/choose_account"
android:exported="true">
<intent-filter android:label="@string/set_profile_picture">
<action android:name="android.intent.action.ATTACH_DATA" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity
android:name=".ui.ShareViaAccountActivity"
android:label="@string/title_activity_share_via_account"
android:launchMode="singleTop"
android:exported="true" />
<activity
android:name=".ui.EditAccountActivity"
android:launchMode="singleTop"
android:exported="true"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".ui.ConferenceDetailsActivity"
android:label="@string/action_muc_details"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.ContactDetailsActivity"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.PublishProfilePictureActivity"
android:label="@string/mgmt_account_publish_avatar"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.PublishGroupChatProfilePictureActivity"
android:exported="true"
android:label="@string/group_chat_avatar" />
<activity
android:name=".ui.ShareWithActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<!-- the value here needs to be the full class name; independent of the configured applicationId -->
<meta-data
android:name="android.service.chooser.chooser_target_service"
android:value="eu.siacs.conversations.services.ContactChooserTargetService" />
</activity>
<activity
android:name=".ui.TrustKeysActivity"
android:label="@string/trust_omemo_fingerprints"
android:exported="true"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:exported="true"
android:theme="@style/Base.Theme.AppCompat" />
<activity android:name=".ui.MemorizingActivity"
android:exported="true" />
<activity
android:name=".ui.MediaBrowserActivity"
android:exported="true"
android:label="@string/media_browser" />
<service android:name=".services.ExportBackupService" android:exported="true"/>
<service android:name=".services.ImportBackupService" android:exported="true"/>
<service
android:name=".services.ContactChooserTargetService"
android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.service.chooser.ChooserTargetService" />
</intent-filter>
</service>
<service android:name=".services.CompulsoryUpdateService" android:exported="true"/>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.files"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<provider
android:name=".services.BarcodeProvider"
android:authorities="${applicationId}.barcodes"
android:exported="false"
android:grantUriPermissions="true" />
<activity
android:name=".ui.ShortcutActivity"
android:label="@string/contact"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
</intent-filter>
</activity>
<activity
android:name=".ui.MucUsersActivity"
android:exported="true"
android:label="@string/group_chat_members" />
<activity
android:name=".ui.ChannelDiscoveryActivity"
android:exported="true"
android:label="@string/discover_channels" />
<activity
android:name=".ui.RtpSessionActivity"
android:autoRemoveFromRecents="true"
android:exported="true"
android:launchMode="singleInstance"
android:supportsPictureInPicture="true" />
</application>
</manifest>
My second manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.siacs.conversations">
<application tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".ui.ManageAccountActivity"
android:label="@string/title_activity_manage_accounts"
android:launchMode="singleTask"
android:exported="true"/>
<activity
android:name=".ui.MagicCreateActivity"
android:label="@string/create_new_account"
android:launchMode="singleTask"
android:exported="true"/>
<activity
android:name=".ui.EasyOnboardingInviteActivity"
android:label="@string/invite_to_app"
android:launchMode="singleTask" />
<activity
android:name=".ui.ImportBackupActivity"
android:label="@string/restore_backup"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.conversations.backup" />
<data android:scheme="content" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.conversations.backup" />
<data android:scheme="file" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="content" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.ceb" />
<data android:pathPattern=".*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.ceb" />
<data android:pathPattern=".*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
</intent-filter>
</activity>
</application>
</manifest>
My gradle file:
import com.android.build.OutputFile
// Top-level build file where you can add configuration options common to all
// sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.21"
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
configurations {
conversationsFreeCompatImplementation
}
dependencies {
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.sufficientlysecure:openpgp-api:10.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.exifinterface:exifinterface:1.3.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.emoji:emoji:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
conversationsFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0'
implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
//zxing stopped supporting Java 7 so we have to stick with 3.3.3
//https://github.com/zxing/zxing/issues/1170
implementation 'com.google.zxing:core:3.4.1'
implementation 'de.measite.minidns:minidns-hla:0.2.4'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
implementation 'org.whispersystems:signal-protocol-java:2.8.1'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation "com.wefika:flowlayout:0.4.1"
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.3.0'
implementation 'org.jxmpp:jxmpp-jid:1.0.1'
implementation 'org.osmdroid:osmdroid-android:6.1.10'
implementation 'org.hsluv:hsluv:0.2'
implementation 'org.conscrypt:conscrypt-android:2.5.2'
implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation "com.leinardi.android:speed-dial:3.2.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.2"
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'com.google.guava:guava:30.1.1-android'
implementation 'org.webrtc:google-webrtc:1.0.32006'
// Lifecycle Helper
implementation "androidx.activity:activity-ktx:1.3.0-rc02"
implementation "androidx.fragment:fragment-ktx:1.3.6"
//Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
//CardView
implementation "androidx.cardview:cardview:1.0.0"
//Country Code Picker
implementation 'com.hbb20:ccp:2.5.3'
//Firebase
implementation 'com.google.firebase:firebase-bom:28.3.0'
implementation 'com.google.firebase:firebase-auth-ktx:21.0.1'
implementation 'androidx.browser:browser:1.3.0'
//OTP view
implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.2'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//Gson
implementation 'com.google.code.gson:gson:2.8.7'
//Multidex
implementation 'androidx.multidex:multidex:2.0.1'
//Round Image
implementation 'de.hdodenhof:circleimageview:3.1.0'
// Button with image and text
implementation 'com.github.Omega-R:OmegaCenterIconButton:0.0.4@aar'
//Razor pay
implementation 'com.razorpay:checkout:1.6.10'
//Mixpanel Tracking
implementation 'com.mixpanel.android:mixpanel-android:5.9.1'
//Loading screen
implementation 'com.wang.avi:library:2.1.3'
//Loading
implementation 'com.wang.avi:library:2.1.3'
//Form
implementation 'com.quickbirdstudios:surveykit:1.1.0'
}
ext {
travisBuild = System.getenv("TRAVIS") == "true"
preDexEnabled = System.getProperty("pre-dex", "true")
abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
}
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 24
targetSdkVersion 31
versionCode 44
versionName "2.0.4"
multiDexEnabled = true
archivesBaseName += "-$versionName"
applicationId "com.app.app"
resValue "string", "applicationId", applicationId
def appName = "app"
resValue "string", "app_name", appName
buildConfigField "String", "APP_NAME", "\"$appName\""
}
splits {
abi {
universalApk true
enable true
}
}
configurations {
compile.exclude group: 'org.jetbrains' , module:'annotations'
}
dataBinding {
enabled true
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
jumboMode true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions("mode", "distribution", "emoji")
productFlavors {
conversations {
dimension "mode"
}
free {
dimension "distribution"
versionNameSuffix "+f"
}
compat {
dimension "emoji"
versionNameSuffix "c"
}
}
sourceSets {
conversationsFreeCompat {
java {
srcDir 'src/freeCompat/java'
srcDir 'src/conversationsFree/java'
}
}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
versionNameSuffix "r"
}
debug {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
versionNameSuffix "d"
}
}
if (new File("signing.properties").exists()) {
Properties props = new Properties()
props.load(new FileInputStream(file("signing.properties")))
signingConfigs {
release {
storeFile file(props['keystore'])
storePassword props['keystore.password']
keyAlias props['keystore.alias']
keyPassword props['keystore.password']
}
}
buildTypes.release.signingConfig = signingConfigs.release
}
lintOptions {
disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
}
subprojects {
afterEvaluate {
if (getPlugins().hasPlugin('android') ||
getPlugins().hasPlugin('android-library')) {
configure(android.lintOptions) {
disable 'AndroidGradlePluginVersion', 'MissingTranslation'
}
}
}
}
packagingOptions {
exclude 'META-INF/BCKEY.DSA'
exclude 'META-INF/BCKEY.SF'
}
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
if (baseAbiVersionCode != null) {
output.versionCodeOverride = (100 * variant.versionCode) + baseAbiVersionCode
}
}
}
}
ANSWER
Answered 2021-Aug-04 at 09:18I'm not sure what you're using to code, but in order to set it in Android Studio, open the manifest of your project and under the "activity" section, put android:exported="true"(or false if that is what you prefer). I have attached an example.
QUESTION
Could not resolve com.google.guava:guava:30.1-jre - Gradle project sync failed. Basic functionality will not work properly - in kotlin project
Asked 2022-Feb-14 at 19:47It was a project that used to work well in the past, but after updating, the following errors appear.
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.retrofit_test"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
// implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'com.google.guava:guava:30.1-jre'
// implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30-M1'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'android.arch.persistence.room:guava:1.1.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
If we need more source code to check, I will update it.
The error contents are as follows.
A problem occurred configuring root project 'Retrofit_Test'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.30/kotlin-gradle-plugin-1.5.30.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :
Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.32/kotlin-stdlib-jdk8-1.4.32.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-model:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
Could not find org.apache.httpcomponents:httpmime:4.5.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/apache/httpcomponents/httpmime/4.5.6/httpmime-4.5.6.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
Could not find commons-io:commons-io:2.4.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/commons-io/commons-io/2.4/commons-io-2.4.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
Could not find org.ow2.asm:asm:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm/7.0/asm-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
Could not find org.ow2.asm:asm-analysis:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-analysis/7.0/asm-analysis-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find org.ow2.asm:asm-commons:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-commons/7.0/asm-commons-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find org.ow2.asm:asm-util:7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/ow2/asm/asm-util/7.0/asm-util-7.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find org.bouncycastle:bcpkix-jdk15on:1.56.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
Could not find org.glassfish.jaxb:jaxb-runtime:2.3.2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/glassfish/jaxb/jaxb-runtime/2.3.2/jaxb-runtime-2.3.2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:repository:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
Could not find net.sf.jopt-simple:jopt-simple:4.9.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find com.squareup:javapoet:1.10.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/squareup/javapoet/1.10.0/javapoet-1.10.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
Could not find com.google.protobuf:protobuf-java:3.10.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java/3.10.0/protobuf-java-3.10.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aapt2-proto:7.0.2-7396180
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-device-provider-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-host-retention-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2 > com.android.tools.analytics-library:protos:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
Could not find com.google.protobuf:protobuf-java-util:3.10.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/protobuf/protobuf-java-util/3.10.0/protobuf-java-util-3.10.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
Could not find com.google.code.gson:gson:2.8.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdklib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
Could not find io.grpc:grpc-core:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-core/1.21.1/grpc-core-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find io.grpc:grpc-netty:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-netty/1.21.1/grpc-netty-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find io.grpc:grpc-protobuf:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-protobuf/1.21.1/grpc-protobuf-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find io.grpc:grpc-stub:1.21.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/grpc/grpc-stub/1.21.1/grpc-stub-1.21.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
Could not find com.google.crypto.tink:tink:1.3.0-rc2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/crypto/tink/tink/1.3.0-rc2/tink-1.3.0-rc2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find com.google.flatbuffers:flatbuffers-java:1.12.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc2/tensorflow-lite-metadata-0.1.0-rc2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2
Could not find org.bouncycastle:bcprov-jdk15on:1.56.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:apkzlib:7.0.2
Could not find com.google.guava:guava:30.1-jre.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/guava/guava/30.1-jre/guava-30.1-jre.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:aaptcompiler:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:crash:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.analytics-library:shared:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > androidx.databinding:databinding-compiler-common:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder-test-api:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:gradle-api:7.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2 > com.android.tools:common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.analytics-library:tracker:30.0.2
Could not find org.jetbrains.kotlin:kotlin-reflect:1.4.32.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-reflect/1.4.32/kotlin-reflect-1.4.32.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
Could not find javax.inject:javax.inject:1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/javax/inject/javax.inject/1/javax.inject-1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:bundletool:1.6.0
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2
Could not find net.sf.kxml:kxml2:2.3.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.ddms:ddmlib:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.lint:lint-model:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.layoutlib:layoutlib-api:30.0.2
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools.build:builder:7.0.2 > com.android.tools.build:manifest-merger:30.0.2
Could not find org.jetbrains.intellij.deps:trove4j:1.0.20181211.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/intellij/deps/trove4j/1.0.20181211/trove4j-1.0.20181211.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
Could not find xerces:xercesImpl:2.12.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/xerces/xercesImpl/2.12.0/xercesImpl-2.12.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.android.tools.build:gradle:7.0.2 > com.android.tools:sdk-common:30.0.2
Could not find org.apache.commons:commons-compress:1.20.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/apache/commons/commons-compress/1.20/commons-compress-1.20.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
ANSWER
Answered 2021-Sep-17 at 11:03Add mavenCentral() in Build Script
repositories {
mavenCentral()
google()
}
QUESTION
Cannot locate a Guava Jar in the gradle distribution?
Asked 2022-Feb-09 at 10:20I have the following error while performing the gradle build
command.
Execution failed for task ':asciidoctor'.
> Cannot locate a Guava JAR in the Gradle distribution
I'm using macOS Big Sur.
ANSWER
Answered 2021-Nov-02 at 18:42I had the same issue on my system.
It appears the problem was the use of the "3.2.0" version of "asciidoctor" plugins. The gradle version I'm currently using is "7.2".
This is the plugins section that was causing the problem:
plugins {
id("org.asciidoctor.jvm.pdf") version "3.2.0"
id("org.asciidoctor.jvm.gems") version "3.2.0"
id("org.asciidoctor.jvm.convert") version "3.2.0"
}
The fix was just to update the versions of these plugins to the latest version, which is "3.3.2".
QUESTION
Unable to find out where reflections-maven plugin comes from
Asked 2022-Jan-02 at 13:34There executes a particular Maven plugin and I struggle to find out where it comes from to either remove or replace it as its compile dependency link is broken. I am talking about org.reflections:reflections-maven:0.9.8
that depends on org.jfrog.jade.plugins.common:jade-plugin-common:1.3.8
which Maven is not able to download from the central repository as the link redirects to OpenMind location and results in 404 (link).
Instead of including such JAR in the project structure, I would rather figure out where is reflections-maven plugin defined as this plugin is discontinued (GitHub) but somehow is executed during the build (mvn clean install
).
[INFO] --- reflections-maven:0.9.5:reflections (default) @ my-module ---
[INFO] Reflections took 240 ms to scan 1 urls, producing 35 keys and 128 values
[INFO] Reflections successfully saved in C:\Dev\my-project\my-parent\my-module\target\classes\META-INF\reflections\my-module-reflections.xml using XmlSerializer
I haven't found where is reflections-maven
defined in any of the multi-module project structure or used. Note I use Maven 3.3.9
. My attempts:
pom.xml
of the failing module and all its parents (the module depends on other modules, however, they were all built successfully before the failing one).mvn dependency:tree -Dverbose
doesn't mention any of reflections-maven
or jade-plugin-common
at all. The command generates over 136k lines, so it was required to save the output into a file and perform the full-text-search. I am afras Maven 3 is the limit here as far as I understand from this comment.depgraph-maven-plugin
gave me the very same negative result.mvn dependency:analyze -DignoreNonCompile
gives only an information that the artifacts were resolved and that where it ends. it doesn't really show anything useful.
[INFO] --- reflections-maven:0.9.5:reflections (default) @ my-module ---
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.reflections:reflections-maven:pom:0.9.5-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\reflections\reflections-maven\0.9.5\reflections-maven-0.9.5.pom-[IJ]-artifactCoord=org.reflections:reflections-maven:pom:0.9.5-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.reflections:reflections-maven:jar:0.9.5-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\reflections\reflections-maven\0.9.5\reflections-maven-0.9.5.jar-[IJ]-artifactCoord=org.reflections:reflections-maven:jar:0.9.5-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.reflections:reflections:jar:0.9.5-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\reflections\reflections\0.9.5\reflections-0.9.5.jar-[IJ]-artifactCoord=org.reflections:reflections:jar:0.9.5-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=com.google.guava:guava:jar:r08-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\com\google\guava\guava\r08\guava-r08.jar-[IJ]-artifactCoord=com.google.guava:guava:jar:r08-[IJ]-error=
...
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.jfrog.maven.annomojo:maven-plugin-anno:jar:1.4.0-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\jfrog\maven\annomojo\maven-plugin-anno\1.4.0\maven-plugin-anno-1.4.0.jar-[IJ]-artifactCoord=org.jfrog.maven.annomojo:maven-plugin-anno:jar:1.4.0-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVING-[IJ]-path=-[IJ]-artifactCoord=org.jfrog.jade.plugins.common:jade-plugin-common:jar:1.3.8-[IJ]-error=
[IJ]-1-ARTIFACT_RESOLVED-[IJ]-path=C:\Users\user\.m2\repository\org\jfrog\jade\plugins\common\jade-plugin-common\1.3.8\jade-plugin-common-1.3.8.jar-[IJ]-artifactCoord=org.jfrog.jade.plugins.common:jade-plugin-common:jar:1.3.8-[IJ]-error=
...
reflections-maven
from here, however, none of the artifacts mentioned appear in my project as well.Question: If I don't have such JAR in the local repository, the build fails as the plugin is executed. In that case, how can I find a way any plugin (particularly reflections-maven
in my case) is truly imported and executed in the project?
Feel free to ask for more info in the commens. I use IntelliJ Idea, Maven 3.3.9 and Java 7 if it matters.
Solution 1 (didn't work for me): I have tried to run mvn -Dverbose=true -Doutput=./effective-pom.xml help:effective-pom
and both the normal and the verbose form of effective-pom
displays the same output of reflections-maven
plugin with no additional information about its origin. Since the file is rather big, I include a screenshot:
This might be an issue with my Maven 3.3.9 with a custom settings.xml
and a specific IntelliJ Idea. I assume the verbose
output would lead to the true origin.
Solution 2:
Upon installing Netbeans (I use IntelliJ Idea by default), the Effective
tab of the POM editor finally led me to the true origin where the plugin is defined.
Sadly, IntelliJ Idea doesn't provide such navigation through its effective POM and navigating to the origin is virtually impossible without manual clicking through parent POMs.
ANSWER
Answered 2022-Jan-02 at 13:33With Help:Effective-Pom:
mvn -Dverbose=true -Doutput=./effective-pom.xml help:effective-pom
We can analyze our "effective pom" (Pom#inheritance, Pom#super-Pom).
verbose
flag will also add the source pom (artifact) as a comment to each output line.output
sets an output file. (default: prints to console)"inter alia" it allows us to locate/override any inherited plugin/dependency/"pom element".
Unfortunately the output generates:
In intellij we have a "Show effective Pom" command, which basically invokes the mentioned goal and shows the output (in community edition unfortunately!?) without "verbose".
netbeans has a "Effective" tab in its "Pom Editor":
(, "Graph" view also very nice...(and unique feature among "maven IDES (that i know)", and it can be installed un-rooted;)!
So the mojo seems to work as documented:
<verbose>
boolean (since:)3.2.0 Output POM input location as comments.Default value is:
false
.User property is:
verbose
.
For verbose
to have an effect, we need to:
<project ...>
...
<build>
<plugins>
<artifactId>maven-help-plugin</artifactId>
<version>3.2.0</version> <!-- or higher! -->
</plugins>
</build>
...
</project>
... respectively can (without pom modification):
mvn -Dverbose=true -Doutput=./eff.pom.xml \
org.apache.maven.plugins:maven-help-plugin:3.2.0:effective-pom
QUESTION
Java method should cache the results
Asked 2022-Jan-01 at 13:18I'm learning programming in the language java.
I need to write an application that takes a string and returns the number of unique characters in the string. It is expected that a string with the same character sequence may be passed several times to the method. Since the counting operation can be time-consuming, the method should cache the results, so that when the method is given a string previously encountered
At this stage, my application is already able to count and display characters
public class Main {
public static void main(String[] args) {
String[] testArray = new String[]{"Java", "is", "the", "best", "programming",
"language", "in", "the", "world!"};
CharCounter charCounter = new CharCounter();
Print print = new Print();
print.printArgs(testArray);
print.print(charCounter.charCounter(testArray));
}
}
/**
* CharCounter should takes a string and returns the number of unique
* characters in the string.
*/
public class CharCounter {
public LinkedHashMap<Character, Integer> charCounter(String[] args) {
LinkedHashMap<Character, Integer> elements = new LinkedHashMap();
List<Character> chars = new ArrayList();
for (char c : stringToCharArray(args)) {
chars.add(c);
}
for (Character element : chars) {
if (elements.containsKey(element)) {
elements.put(element, elements.get(element) + 1);
} else {
elements.put(element, 1);
}
}
return elements;
}
/**
* stringToCharArray method - convert string array to character array *
*/
private char[] stringToCharArray(String[] args) {
String s = "";
for (String agr : args) {
if (s == "") {
s = agr;
} else {
s = s + " " + agr;
}
}
return s.toCharArray();
}
}
/**
* The Print class is intended to output the result to the console
*/
public class Print {
public void print(Map map) {
Iterator<Map.Entry<Character, Integer>> iterator
= map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Character, Integer> charCounterEntry = iterator.next();
System.out.printf("\"%c\" - %d\n", charCounterEntry.getKey(),
charCounterEntry.getValue());
}
}
public void printArgs(String[] args) {
for (String arg : args) {
System.out.printf("%s ", arg);
}
System.out.println();
}
}
The result of the application
Java is the best programming language in the world!
"J" - 1
"a" - 5
"v" - 1
" " - 8
"i" - 3
"s" - 2
"t" - 3
"h" - 2
"e" - 4
"b" - 1
"p" - 1
"r" - 3
"o" - 2
"g" - 4
"m" - 2
"n" - 3
"l" - 2
"u" - 1
"w" - 1
"d" - 1
"!" - 1
Now I need to teach my application to cache and check the input data for an already existing result.
I think LoadingCache from Guava will help me
LoadingCache<Key, Graph> graphs = CacheBuilder.newBuilder()
.maximumSize(1000)
.expireAfterWrite(10, TimeUnit.MINUTES)
.removalListener(MY_LISTENER)
.build(
new CacheLoader<Key, Graph>() {
@Override
public Graph load(Key key) throws AnyException {
return createExpensiveGraph(key);
}
});
Please help me pair my app with LoadingCache.
To all who will respond, thanks a lot!
ANSWER
Answered 2022-Jan-01 at 13:18Please help me pair my app with LoadingCache.
Merry X-Mas! There you go:
LoadingCache<Key, Graph>
applied to our code must be LoadingCache<String[],Map<Character, Integer>>
matching the input and output types of our ...createExpensiveGraph
method applied to our case would be charCounter
.charCounter(...)
directly, but through a (given) cache instance, so: graphs.get(...)
.I refactored "little" (simplified String[]
to String
, removed "half" of your classes, made the main method interactive), this is what came out:
pom.xml:
<project>
<!-- only defaults ..., and: -->
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.0.1-jre</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
</project>
Main.java
package com.stackoverflow.cache.test;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import java.util.LinkedHashMap;
import java.util.Scanner;
import java.util.concurrent.ExecutionException;
public class Main {
static final LoadingCache<String, LinkedHashMap<Character, Integer>> CACHE = CacheBuilder.newBuilder()
.build( // with defaults, and this loader:
new CacheLoader<String, LinkedHashMap<Character, Integer>>() {
@Override
public LinkedHashMap<Character, Integer> load(String key) {
System.out.format("Key: \"%s\" not cached.%n", key);
return analyze(key); // invoking "expensive calculation"!
}
});
public static void main(String[] args) throws ExecutionException {
try ( Scanner consoleScanner = new Scanner(System.in)) {
String word = consoleScanner.nextLine().trim(); // line wise! (for word-wise: next())
while (!"bye".equalsIgnoreCase(word)) {// from Yoda, greetings! https://blog.codinghorror.com/new-programming-jargon/#1 ;)
System.out.println(CACHE.get(word));// invoke cache, instead of "expensive" calculation!
word = consoleScanner.nextLine().trim(); // line wise! (for word-wise: next())
}
System.out.println("Bye!");
}
}
// basically your charCounter method with single parameter + stream:
static LinkedHashMap<Character, Integer> analyze(String arg) {
LinkedHashMap<Character, Integer> elements = new LinkedHashMap();
arg.chars().forEach((num) -> {
Character c = (char) num;
if (elements.containsKey(c)) {
elements.put(c, elements.get(c) + 1);
} else {
elements.put(c, 1);
}
});
return elements;
}
}
In- and Output:
>Java is the best programming language in the world!
Key: "Java is the best programming language in the world!" not cached.
{J=1, a=5, v=1, =8, i=3, s=2, t=3, h=2, e=4, b=1, p=1, r=3, o=2, g=4, m=2, n=3, l=2, u=1, w=1, d=1, !=1}
>hello
Key: "hello" not cached.
{h=1, e=1, l=2, o=1}
>hello
{h=1, e=1, l=2, o=1}
>bye
Bye!
(2nd calculation of "hello" is cached.)
We see: Once identifying/understanding/defining
, it is easy to a apply a (guava) cache to a given "operation".
For advanced cache configuration, please refer to CacheBuilder javadoc, for advanced usage to LoadingCache javadoc.
Rather advanced and theoretical but very related to this topic/ use case: Similarity Caching.
To receive "words" from command line arguments, we can use a main()
method like this:
public static void main(String[] args) throws ExecutionException {
for (String word : args) {
System.out.println(CACHE.get(word)); // ...or custom "print" method
}
}
To make it completely "without external libs" (i.e. guava)we would (remove/clean up that dependencies,) we would then use it, as outlined in (accepted answer of) Easy, simple to use LRU cache in java :
// limited version:
static final int MAX_ENTRIES = 100;
static final Map<String, Map<Character, Integer>> CACHE = new LinkedHashMap<>(
MAX_ENTRIES + 1, // initial capacity
1.0f, // load factor: better 1. than 0.75 (in this setup!?)
true // "accessOrder" flag
) {
// eviction: "...This method is invoked by put and putAll after inserting a new entry into the map"
public boolean removeEldestEntry(Map.Entry eldest) {
return size() > MAX_ENTRIES;
}
};
for "unlimited" cache (might be sufficient for tutor;), just:
// no limit, no "order", no evict, no outdate:
static final Map<String, Map<Character, Integer>> CACHE = new HashMap<>();
(For a thread-safe version, we'd have to:)
... CACHE = Collections.synchronizedMap(new xxxMap...);
We could wrap our "cache loading" then like:
static Map<Character, Integer> load(String key) {
final Map<Character, Integer> result;
if (CACHE.containsKey(key)) { // cached!
result = CACHE.get(key);
// to "refresh" key, put it again (LRU):
// CACHE.put(key, result); // here or outside the if-else
} else { // "expensive" calculation:
result = analyze(key); // ... and add to cache (unlimited, or removingEldest(imlicitely!!)):
CACHE.put(key, result);
}
return result;
}
and main method like:
public static void main(String[] args) {
for (String word : args) {
System.out.println(load(word));
}
}
;)#
QUESTION
Launching chrome in headless mode with selenium in Java giving error
Asked 2021-Dec-31 at 13:08This is my code:
WebDriverManager.chromedriver().setup();
System.setProperty("webdriver.chrome.driver", "src/main/extras/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
WebDriver driver = new ChromeDriver(options);
driver = new ChromeDriver();
driver.get(url);
The last line, getting the URL, is giving this error:
Exception in thread "Thread-3" java.lang.NullPointerException
I wasn't getting this error before I tried to launch the browser in headless mode.
This is my full error message thing:
"D:\Program Files\Amazon Corretto\jdk11.0.11_9\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2\lib\idea_rt.jar=59273:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\jackg\.m2\repository\org\openjfx\javafx-controls\11.0.2\javafx-controls-11.0.2.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-graphics\11.0.2\javafx-graphics-11.0.2.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-fxml\11.0.2\javafx-fxml-11.0.2.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-web\11.0.2\javafx-web-11.0.2.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-media\11.0.2\javafx-media-11.0.2.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-base\11.0.1\javafx-base-11.0.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-java\4.1.1\selenium-java-4.1.1.jar;C:\Users\jackg\.m2\repository\com\google\auto\service\auto-service-annotations\1.0.1\auto-service-annotations-1.0.1.jar;C:\Users\jackg\.m2\repository\com\google\auto\service\auto-service\1.0.1\auto-service-1.0.1.jar;C:\Users\jackg\.m2\repository\com\google\auto\auto-common\1.2\auto-common-1.2.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-devtools-v85\4.1.1\selenium-devtools-v85-4.1.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-devtools-v94\4.1.1\selenium-devtools-v94-4.1.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-devtools-v95\4.1.1\selenium-devtools-v95-4.1.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-devtools-v96\4.1.1\selenium-devtools-v96-4.1.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-edge-driver\4.1.1\selenium-edge-driver-4.1.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\4.1.1\selenium-firefox-driver-4.1.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-firefox-xpi-driver\4.1.1\selenium-firefox-xpi-driver-4.1.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-ie-driver\4.1.1\selenium-ie-driver-4.1.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-opera-driver\4.1.1\selenium-opera-driver-4.1.1.jar;C:\Users\jackg\.m2\repository\io\netty\netty-codec\4.1.70.Final\netty-codec-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\io\netty\netty-handler\4.1.70.Final\netty-handler-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\io\netty\netty-resolver\4.1.70.Final\netty-resolver-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-exporter-logging\1.9.1\opentelemetry-exporter-logging-1.9.1.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-sdk-metrics\1.9.1-alpha\opentelemetry-sdk-metrics-1.9.1-alpha.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-sdk-logs\1.9.1-alpha\opentelemetry-sdk-logs-1.9.1-alpha.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-api-metrics\1.9.1-alpha\opentelemetry-api-metrics-1.9.1-alpha.jar;C:\Users\jackg\.m2\repository\org\asynchttpclient\async-http-client-netty-utils\2.12.3\async-http-client-netty-utils-2.12.3.jar;C:\Users\jackg\.m2\repository\io\netty\netty-codec-socks\4.1.60.Final\netty-codec-socks-4.1.60.Final.jar;C:\Users\jackg\.m2\repository\io\netty\netty-handler-proxy\4.1.60.Final\netty-handler-proxy-4.1.60.Final.jar;C:\Users\jackg\.m2\repository\io\netty\netty-transport-native-epoll\4.1.60.Final\netty-transport-native-epoll-4.1.60.Final-linux-x86_64.jar;C:\Users\jackg\.m2\repository\io\netty\netty-transport-native-kqueue\4.1.60.Final\netty-transport-native-kqueue-4.1.60.Final-osx-x86_64.jar;C:\Users\jackg\.m2\repository\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;C:\Users\jackg\.m2\repository\com\typesafe\netty\netty-reactive-streams\2.0.4\netty-reactive-streams-2.0.4.jar;C:\Users\jackg\.m2\repository\com\sun\activation\jakarta.activation\1.2.2\jakarta.activation-1.2.2.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-safari-driver\4.1.1\selenium-safari-driver-4.1.1.jar;C:\Users\jackg\.m2\repository\org\slf4j\slf4j-api\1.7.32\slf4j-api-1.7.32.jar;C:\Users\jackg\.m2\repository\com\google\code\gson\gson\2.8.8\gson-2.8.8.jar;C:\Users\jackg\.m2\repository\org\jsoup\jsoup\1.14.2\jsoup-1.14.2.jar;C:\Users\jackg\.m2\repository\com\github\docker-java\docker-java\3.2.12\docker-java-3.2.12.jar;C:\Users\jackg\.m2\repository\com\github\docker-java\docker-java-core\3.2.12\docker-java-core-3.2.12.jar;C:\Users\jackg\.m2\repository\com\github\docker-java\docker-java-api\3.2.12\docker-java-api-3.2.12.jar;C:\Users\jackg\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.10.3\jackson-annotations-2.10.3.jar;C:\Users\jackg\.m2\repository\commons-io\commons-io\2.6\commons-io-2.6.jar;C:\Users\jackg\.m2\repository\org\apache\commons\commons-compress\1.21\commons-compress-1.21.jar;C:\Users\jackg\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\jackg\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.10.3\jackson-databind-2.10.3.jar;C:\Users\jackg\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.10.3\jackson-core-2.10.3.jar;C:\Users\jackg\.m2\repository\org\bouncycastle\bcpkix-jdk15on\1.64\bcpkix-jdk15on-1.64.jar;C:\Users\jackg\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.64\bcprov-jdk15on-1.64.jar;C:\Users\jackg\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.30\jcl-over-slf4j-1.7.30.jar;C:\Users\jackg\.m2\repository\com\github\docker-java\docker-java-transport-httpclient5\3.2.12\docker-java-transport-httpclient5-3.2.12.jar;C:\Users\jackg\.m2\repository\com\github\docker-java\docker-java-transport\3.2.12\docker-java-transport-3.2.12.jar;C:\Users\jackg\.m2\repository\org\apache\httpcomponents\client5\httpclient5\5.0.3\httpclient5-5.0.3.jar;C:\Users\jackg\.m2\repository\org\apache\httpcomponents\core5\httpcore5\5.0.2\httpcore5-5.0.2.jar;C:\Users\jackg\.m2\repository\commons-codec\commons-codec\1.13\commons-codec-1.13.jar;C:\Users\jackg\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\jackg\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\jackg\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\jackg\.m2\repository\org\checkerframework\checker-qual\3.8.0\checker-qual-3.8.0.jar;C:\Users\jackg\.m2\repository\com\google\errorprone\error_prone_annotations\2.5.1\error_prone_annotations-2.5.1.jar;C:\Users\jackg\.m2\repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;C:\Users\jackg\.m2\repository\org\brotli\dec\0.1.2\dec-0.1.2.jar;C:\Users\jackg\.m2\repository\org\apache\commons\commons-lang3\3.12.0\commons-lang3-3.12.0.jar;C:\Users\jackg\.m2\repository\org\apache\commons\commons-text\1.9\commons-text-1.9.jar;C:\Users\jackg\.m2\repository\commons-beanutils\commons-beanutils\1.9.4\commons-beanutils-1.9.4.jar;C:\Users\jackg\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\jackg\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\jackg\.m2\repository\org\apache\commons\commons-collections4\4.4\commons-collections4-4.4.jar -p "C:\Users\jackg\.m2\repository\org\openjfx\javafx-base\11.0.1\javafx-base-11.0.1-win.jar;C:\Users\jackg\.m2\repository\io\netty\netty-transport-classes-kqueue\4.1.70.Final\netty-transport-classes-kqueue-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\org\controlsfx\controlsfx\11.1.0\controlsfx-11.1.0.jar;C:\Users\jackg\.m2\repository\net\synedra\validatorfx\0.1.13\validatorfx-0.1.13.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-sdk\1.9.1\opentelemetry-sdk-1.9.1.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-graphics\11.0.2\javafx-graphics-11.0.2-win.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-fxml\11.0.2\javafx-fxml-11.0.2-win.jar;C:\Users\jackg\.m2\repository\com\beust\jcommander\1.81\jcommander-1.81.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-controls\11.0.2\javafx-controls-11.0.2-win.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-chromium-driver\4.1.1\selenium-chromium-driver-4.1.1.jar;C:\Users\jackg\.m2\repository\io\netty\netty-transport-classes-epoll\4.1.70.Final\netty-transport-classes-epoll-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-api\4.1.1\selenium-api-4.1.1.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-json\4.1.1\selenium-json-4.1.1.jar;C:\Users\jackg\.m2\repository\net\java\dev\jna\jna\5.8.0\jna-5.8.0.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-sdk-extension-autoconfigure-spi\1.9.1\opentelemetry-sdk-extension-autoconfigure-spi-1.9.1.jar;C:\Users\jackg\.m2\repository\net\jodah\failsafe\2.4.4\failsafe-2.4.4.jar;C:\Users\jackg\.m2\repository\io\netty\netty-transport-native-unix-common\4.1.70.Final\netty-transport-native-unix-common-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\io\netty\netty-codec-http\4.1.70.Final\netty-codec-http-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-sdk-extension-autoconfigure\1.9.1-alpha\opentelemetry-sdk-extension-autoconfigure-1.9.1-alpha.jar;C:\Users\jackg\.m2\repository\net\bytebuddy\byte-buddy\1.12.2\byte-buddy-1.12.2.jar;C:\Users\jackg\.m2\repository\io\netty\netty-buffer\4.1.70.Final\netty-buffer-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\io\github\bonigarcia\webdrivermanager\5.0.3\webdrivermanager-5.0.3.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-sdk-common\1.9.1\opentelemetry-sdk-common-1.9.1.jar;C:\Users\jackg\.m2\repository\org\apache\commons\commons-exec\1.3\commons-exec-1.3.jar;C:\Users\jackg\.m2\repository\io\netty\netty-common\4.1.70.Final\netty-common-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\org\kordamp\ikonli\ikonli-javafx\12.2.0\ikonli-javafx-12.2.0.jar;C:\Users\jackg\.m2\repository\com\dlsc\formsfx\formsfx-core\11.4.2\formsfx-core-11.4.2.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-sdk-trace\1.9.1\opentelemetry-sdk-trace-1.9.1.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-api\1.9.1\opentelemetry-api-1.9.1.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-web\11.0.2\javafx-web-11.0.2-win.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-context\1.9.1\opentelemetry-context-1.9.1.jar;C:\Users\jackg\.m2\repository\com\google\guava\guava\30.1.1-jre\guava-30.1.1-jre.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\4.1.1\selenium-chrome-driver-4.1.1.jar;C:\Users\jackg\.m2\repository\com\opencsv\opencsv\5.5.2\opencsv-5.5.2.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-support\4.1.1\selenium-support-4.1.1.jar;C:\Users\jackg\.m2\repository\org\kordamp\bootstrapfx\bootstrapfx-core\0.4.0\bootstrapfx-core-0.4.0.jar;C:\Users\jackg\.m2\repository\org\openjfx\javafx-media\11.0.2\javafx-media-11.0.2-win.jar;C:\Users\jackg\.m2\repository\eu\hansolo\tilesfx\11.48\tilesfx-11.48.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-http\4.1.1\selenium-http-4.1.1.jar;C:\Users\jackg\.m2\repository\org\asynchttpclient\async-http-client\2.12.3\async-http-client-2.12.3.jar;C:\Users\jackg\.m2\repository\io\opentelemetry\opentelemetry-semconv\1.9.1-alpha\opentelemetry-semconv-1.9.1-alpha.jar;C:\Users\jackg\.m2\repository\io\ous\jtoml\2.0.0\jtoml-2.0.0.jar;C:\Users\jackg\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\4.1.1\selenium-remote-driver-4.1.1.jar;C:\Users\jackg\.m2\repository\io\netty\netty-transport\4.1.70.Final\netty-transport-4.1.70.Final.jar;C:\Users\jackg\.m2\repository\org\kordamp\ikonli\ikonli-core\12.2.0\ikonli-core-12.2.0.jar;D:\Users\jackg\Desktop\Java Code\Ethermine Tracker JavaFX\target\classes" -m com.traptricker.etherminetrackerjavafx/com.traptricker.etherminetrackerjavafx.Main
Dec 30, 2021 9:22:25 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 17 by JavaFX runtime of version 11.0.1
Starting program...
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 95.0.4638.17 (a9d0719444d4b035e284ed1fce73bf6ccd789df2-refs/branch-heads/4638@{#178}) on port 63013
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1640917354.440][WARNING]: This version of ChromeDriver has not been tested with Chrome version 96.
Dec 30, 2021 9:22:34 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Dec 30, 2021 9:22:34 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
INFO: Found exact CDP implementation for version 96
Starting ChromeDriver 95.0.4638.17 (a9d0719444d4b035e284ed1fce73bf6ccd789df2-refs/branch-heads/4638@{#178}) on port 53163
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1640917356.435][WARNING]: This version of ChromeDriver has not been tested with Chrome version 96.
Dec 30, 2021 9:22:36 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Dec 30, 2021 9:22:36 PM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
INFO: Found exact CDP implementation for version 96
Exception in thread "Thread-3" java.lang.NullPointerException
at com.traptricker.etherminetrackerjavafx/com.traptricker.etherminetrackerjavafx.SeleniumScrapper.setUpWebdriver(SeleniumScrapper.java:31)
at com.traptricker.etherminetrackerjavafx/com.traptricker.etherminetrackerjavafx.Controller.trackEthermine(Controller.java:54)
at java.base/java.lang.Thread.run(Thread.java:829)
ANSWER
Answered 2021-Dec-31 at 13:08You need to take care of a few things here:
You have already download the ChromeDriver and accessing it as:
System.setProperty("webdriver.chrome.driver", "src/main/extras/chromedriver.exe");
Additionally you are also downloading ChromeDriver through WebDriverManager as:
WebDriverManager.chromedriver().setup();
As a result your program have access to multiple instances of ChromeDriver. Hence you see:
Exception in thread "Thread-3" java.lang.NullPointerException
You need to use only one instance of ChromeDriver either the downloaded version or the one downloaded and accessed through WebDriverManager
QUESTION
How to import a file from another directory in Kotlin?
Asked 2021-Dec-25 at 09:08I have a gradle kotlin project, and I'm generating a kotlin file from a Rust project, so it ends up in a totally different place with no gradle project structure, etc.
How do I import this file into my gradle project?
It has its own package but it's a completely standalone file. This is my gradle file:
rootProject.name = "my_project"
include("app")
It's a desktop project, NOT android.
My build.gradle.kts:
plugins {
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "1.5.31"
// Apply the application plugin to add support for building a CLI application in Java.
application
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// This dependency is used by the application.
implementation("com.google.guava:guava:30.1.1-jre")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
application {
// Define the main class for the application.
mainClass.set("my_project.ffi.AppKt")
}
ANSWER
Answered 2021-Dec-25 at 09:08Adding the following code to your build.gradle.kts
should do the trick (tested with Gradle 7.3.2):
// TODO: replace this dummy task with the task from your Rust project which
// generates the Kotlin source directory. Make sure that the generated
// directory (with the Kotlin file(s)) is the task output directory.
val rustTask by tasks.registering(Copy::class) {
// To test this, I had simply put a Kotlin file into this "somewhere"
// directory.
from("somewhere")
into(temporaryDir)
}
sourceSets {
main {
java {
srcDir(rustTask)
}
}
}
tasks {
compileKotlin {
dependsOn(rustTask)
}
}
So, we’re simply adding the generated sources as an additional source directory to the default SourceSet
which is consumed by the compileKotlin
task. In addition, we make sure that the sources are generated before compileKotlin
runs.
QUESTION
Abstract database methods must return a @Dao annotated class or interface
Asked 2021-Dec-14 at 04:32I think this topic already existed. But, since we have a new version of room database, it will be helpful to me to understand better. So, I am implementing a room database with the version 2.3.0 but I am getting lot of errors:
Type of the parameter must be a class annotated with @Entity or a collection/array of it. kotlin.coroutines.Continuation<? super kotlin.Unit> continuation);
Not sure how to handle insert method's return type. public abstract java.lang.Object insertStudent(@org.jetbrains.annotations.NotNull()
Abstract database methods must return a @Dao annotated class or interface. public abstract void setConnectDatabaseDao(@org.jetbrains.annotations.NotNull()
Like said here, I added ktx extension to support suspendable meethods in Dao. But it's still giving me these errors. Here are my code : app build gradle
plugins {
id 'com.android.application'
id 'kotlin-android-extensions'
id 'kotlin-android'
//id 'kotlin-parcelize'
}
apply plugin: 'kotlin-kapt'
...
//room data base
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
kapt "androidx.lifecycle:lifecycle-compiler:2.4.0"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
// optional - RxJava2 support for Room
implementation "androidx.room:room-rxjava2:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture
implementation "androidx.room:room-guava:$room_version"
// optional - Test helpers
testImplementation "androidx.room:room-testing:$room_version"
// optional - Paging 3 Integration
implementation "androidx.room:room-paging:2.4.0-rc01"
Database
@Database(entities = [Skill::class, Student::class], version = 1, exportSchema = false)
abstract class ConnectDatabase():RoomDatabase() {
abstract var connectDatabaseDao:ConnectDatabaseDao
companion object{
@Volatile
var INSTANCE:ConnectDatabase? = null
fun getInstance(context:Context): ConnectDatabase {
synchronized(this) {
var instance = INSTANCE
if (instance == null) {
instance = Room.databaseBuilder(
context,
ConnectDatabase::class.java,
"connect_database"
)
.fallbackToDestructiveMigration()
.build()
INSTANCE = instance
}
return instance
}
}
}
}
Dao
@Dao
interface ConnectDatabaseDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertStudent(student: Student)
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertSkill (skill: Skill)
@Delete
suspend fun deleteStudent(student: Student)
@Delete
suspend fun deleteSkill(skill: Skill)
@Query("SELECT * FROM student WHERE id = :id")
suspend fun getStudent(id:Long):Student?
@Query("SELECT * FROM skill WHERE id = :id")
suspend fun getSkill(id:Long):Skill?
@Query("SELECT * FROM student")
fun getAllStudent():LiveData<List<Student>?>
@Query("SELECT * FROM skill")
fun getAllSkill():LiveData<List<Skill>?>
}
Data class
@Parcelize
@Entity(tableName = "student",
foreignKeys = arrayOf(
ForeignKey(entity = Skill::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("id_skill"),
onDelete = ForeignKey.CASCADE
)
)
)
data class Student (
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "id")
val id: Long,
@ColumnInfo(name = "name")
val name: String,
@ColumnInfo(name= "email")
val email: String,
@ColumnInfo(name = "id_skill")
val idSkill: Long
):Parcelable
@Parcelize
@Entity(tableName = "skill")
data class Skill (
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "id")
val id: Long,
@ColumnInfo(name = "item")
val item:String
): Parcelable
Do someone knows what create the problem please ?
ANSWER
Answered 2021-Dec-14 at 04:32One issue is as per the title so :-
abstract var connectDatabaseDao:ConnectDatabaseDao
should instead be
abstract fun getConnectDatabaseDao(): ConnectDatabaseDao
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
HTTPS
https://github.com/google/guava.git
CLI
gh repo clone google/guava
SSH
git@github.com:google/guava.git
Share this Page
by CyC2018
by Snailclimb
by iluwatar
by MisterBooo
by spring-projects
See all Java Libraries
by google JavaScript
by google HTML
by google HTML
by google C++
by google C++
See all Libraries by this author
by elastic
by spring-projects
by bazelbuild
by google
by alibaba
See all Java Libraries
by hzh0425
by dadoonet
by Proximyst
by karlroberts
by markeeftb
See all Java Libraries
by hzh0425
by fabriciorby
by eduardoklosowski
by akotoe
by dadoonet
See all Java Libraries
by hzh0425
by lybbyl
by Maskhe
by fabriciorby
by yusugomori
See all Java Libraries
by junichi11
by mrmans0n
by wihoho
by jsog
by chalup
See all Java Libraries
Save this library and start creating your kit
Open Weaver – Develop Applications Faster with Open Source