import javax.swing.* is showing unresolved reference to import i have tried to do some google searches and youtube but no result also tried to search for some dependencies
build.gradle:-
`plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.example"
minSdkVersion 18
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
packagingOptions {
pickFirst 'androidsupportmultidexversion.txt'
}
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'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.intellij:forms_rt:7.0.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:28.0.1')
implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.google.firebase:firebase-core:19.0.0'
implementation 'com.android.support:multidex:1.0.3'
}`
You can NOT use Swing in Android
This is because Swing is developed for Java SE, while Android is based on Android's own implementation of Java. Since both Java implementations differ, you cannot use Swing in Android.
Instead, use the UI components provided by Android to build your app's UI. You can follow this guide to build a simple UI.
PS: If you are curious of how both Java differ, you can read this.
Related
Here is my build.gradle(:app) file:
plugins {
id 'com.android.application'
}
[enter image description here][1]
android {
compileSdk 32
defaultConfig {
applicationId "com.example.peon"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures{
viewBinding 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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.mediarouter:mediarouter:1.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'io.github.chaosleung:pinview:1.4.4'
implementation platform('com.google.firebase:firebase-bom:29.3.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-storage'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.github.bumptech.glide:glide:4.13.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
implementation "com.github.pgreze:android-reactions:1.6"
implementation("app.futured.donut:donut:2.2.2")
implementation 'com.github.OMARIHAMZA:StoryView:1.0.6-alpha'
}
enter code here
apply plugin: 'com.google.gms.google-services'
**It shows: Failed to resolve: **
[1]: https://i.stack.imgur.com/zbOc1.png
I've tried to use double quotes, clean and rebuild the project, as well as restarting my android studio. Yet I can't solve this problem. Am I missing something? Thanks in advance.
This error appears when I extract a file aab:
Invalid dex file indices, expecting file 'classesŁ¢.dex' but found 'classes2.dex'.
my Gradle app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.rewardstom.win"
minSdkVersion 19
multiDexEnabled true
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
checkReleaseBuilds false
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.multidex:multidex:2.0.1'
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.palette:palette:1.0.0'
implementation 'com.android.volley:volley:1.2.0'
implementation 'com.facebook.android:facebook-login:7.1.0'
implementation platform('com.google.firebase:firebase-bom:28.2.0')
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.android.gms:play-services-auth:19.2.0'
implementation 'com.google.firebase:firebase-dynamic-links'
implementation "androidx.browser:browser:1.3.0"
//Ads
implementation 'com.google.android.gms:play-services-ads:20.2.0'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'
implementation 'com.google.android.gms:play-services-basement:17.6.0'
api 'com.tapjoy:tapjoy-android-sdk:12.8.0#aar'
implementation 'com.fyber:offerwall-sdk:9.2.2'
implementation 'com.applovin:applovin-sdk:10.2.1'
implementation 'com.adcolony:sdk:4.5.0'
implementation 'com.chartboost:chartboost-sdk:8.2.0'
implementation 'com.ironsource.sdk:mediationsdk:7.1.7'
implementation 'com.github.vungle:vungle-android-sdk:6.7.1'
implementation 'com.facebook.android:audience-network-sdk:6.5.1'
//noinspection GradleDependency
implementation 'commons-io:commons-io:2.4'
}
apply plugin: 'com.google.gms.google-services'
One temporary solution that may work is to set
release {
minifyEnabled false
.......
}
This will reduce your app size which may cause it to use only one dex file.
If this didn't work, you need to change your Windows display language to a language that uses. Arabic Numerals (including your Administrative language settings).
Hello i had a problem with my project when i run it this message appear
Execution failed for task ':app:checkDebugAarMetadata'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find androidx.recycleview:recycleview:1.1.0.
and this my graddle looks like
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.example.mysubmission"
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 "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.recycleview:recycleview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
I didnt know how to resolve it yet if someone know how to fix it i appreciate it
Replace
implementation 'androidx.recycleview:recycleview:1.1.0'
with
implementation 'com.google.android.material:material:1.3.0'
It's my first time building AAR
The official site says that All I hate to do is build APK and AAR will be assembled
Here's the quote:
But when I choose "Build Apk(s)" nothing happens.
Another tutorial says I have to choose Gradle-> library name -> tasks-> build-> :assembleRelease.
But there is no such thing :
How can I assemble library as AAR?
here's my gradle :
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 17
targetSdkVersion 29
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 "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
def room_version = "2.2.3"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
implementation 'com.google.code.gson:gson:2.8.2'
}
Just click assemble or add buildTypes.debug. While you don't have buildTypes.debug defined, it won't generate the tasks you are looking for (as there only is one configuration present there and so there is nothing to tell apart).
I am trying to implement Playback Notifications with ExoPlayer. But getTitle,getDescription,createPendingIntent(), getLargeIcon are missing and android studio is showing red (Cannot resolve method). How can i get these?
I wrote my code exactly same as the link. I tried it multiple times.
This is my build.gradle file (if required):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.mediaplayertest"
minSdkVersion 18
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.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
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "com.android.support:support-media-compat:28.0.0"
implementation "com.android.support:support-compat:28.0.0"
implementation 'com.google.android.exoplayer:exoplayer:2.9.5'
}
You need to define the gradle implementation correctly.
From The hello world example
implementation 'com.google.android.exoplayer:exoplayer-core:2.X.X'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.X.X'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.X.X'
In your gradle build script you have asked for the just "exoplayer"
NOTE: that for the PlaybackNotificationManager class you will need exoplayer-ui meaning for that particular class you would just need
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.5' but I would also include exoplayer-core