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
Related
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.
I'm trying to test the FAB concept in my app but it's not working following the guidelines i got maybe because i didn't understand it well, see my gradle file below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "study.timmy.micah.materialdesignpractices"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:28.0.0-alpha1'
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'
}
earlier was working fine but the time i updated the versions of libraries it went wrong
here is the app.gradle file, also tested with compile version 27 and 28 as well
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.test"
minSdkVersion 19
targetSdkVersion 26
multiDexEnabled true
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
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
after changing dependendencies to androidX version , issue is there
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'
implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
in build.gradle file
classpath 'com.android.tools.build:gradle:3.1.2'
I am following the guide for adding google login to my android application: https://aws-amplify.github.io/docs/android/authentication#google-login-in-your-mobile-app
And I am getting this error:
E/AndroidRuntime: FATAL EXCEPTION: Thread-4
Process: com.xxxx.xxxx, PID: 16057
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amazonaws/mobile/auth/userpools/CognitoUserPoolsSignInProvider;
(note the error message is much longer)
My AuthenticatorActivity looks exactly like what they provide (with the imports needed). I am guessing it has something to do with the app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.xxxx.xxxx"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
// Mobile Client for initializing the SDK
implementation('com.amazonaws:aws-android-sdk-mobile-client:2.8.+#aar') { transitive = true }
// Google SignIn
implementation 'com.android.support:support-v4:28.+'
implementation('com.amazonaws:aws-android-sdk-auth-google:2.8.+#aar') { transitive = true }
// Sign in UI Library
implementation 'com.android.support:appcompat-v7:28.+'
implementation('com.amazonaws:aws-android-sdk-auth-ui:2.8.+#aar') { transitive = true }
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:27.1.1'
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'
}
But I am not sure what. Something with the way I am importing the mobile client? It is the way they say it should be done.
You should add the following to the dependency section of your app's build.gradle file :
implementation 'com.amazonaws:aws-android-sdk-auth-userpools:2.8.+'
Hope it helps!
I am trying to update from couchbase.lite 1.4.0 to 2.0.0, but when I update and sync my build.gradle file I seem keep getting 'cannot resolve symbol' errors for my imports (AndroidContext, Document, and Database). After looking at the dcoumentation, it appears that all I have change change is:
implementation 'com.couchbase.lite:couchbase-lite-android:1.4.0'
to
implementation 'com.couchbase.lite:couchbase-lite-android:2.0.0'
unless I missed something else...
Here is my complete build.grade file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.my.app"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.couchbase.lite:couchbase-lite-android:2.0.0'
implementation 'com.couchbase.lite:couchbase-lite-android-forestdb:1.4.1'
}