I cannot build for android. I've this output
:react-native-track-player:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:react-native-track-player:compileReleaseJavaWithJavac
:react-native-track-player:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/home/user/Workspace/react-native-track-player/example/node_modules/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:20: error: package android.support.v4.media.app.NotificationCompat does not exist
import android.support.v4.media.app.NotificationCompat.MediaStyle;
^
/home/user/Workspace/react-native-track-player/example/node_modules/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:42: error: cannot find symbol
private MediaStyle style;
^
symbol: class MediaStyle
location: class MediaNotification
/home/user/Workspace/react-native-track-player/example/node_modules/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:58: error: constructor Builder in class Builder cannot be applied to given types;
this.nb = new Builder(context, "trackplayer");
^
required: Context
found: Context,String
reason: actual and formal argument lists differ in length
/home/user/Workspace/react-native-track-player/example/node_modules/react-native-track-player/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java:59: error: cannot find symbol
this.style = new MediaStyle().setMediaSession(session.getSessionToken());
^
symbol: class MediaStyle
location: class MediaNotification
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors
:react-native-track-player:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-track-player:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
When I try to add support-v4 library I've this error:
* Where:
Build file '/home/user/Workspace/react-native-track-player/example/android/build.gradle' line: 38
* What went wrong:
A problem occurred evaluating root project 'example'.
> Could not find method compile() for arguments [com.android.support:support-v4:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
same issue here
hey @djmMax I just fixed it by adjusting some parameters on react-native-track-player's build gradle file.
Just added these rows:
dependencies {
...
compile 'com.android.support:support-media-compat:26.+'
compile 'com.android.support:support-v4:27.0.0'
}
and updated compileSdkVersion to 27 and buildToolsVersion to 26.0.2
Not sure if it's a good fix, but my app works fine now.
Can you try it?
@mursang can you provide build.gradle full file???
I'm also having this issue.
I faced same trouble, and i tried with version 0.2.4, it is working property.
hey @yogeshmoradiya121 here's my RNTrackPlayer's gradle file:
import groovy.json.JsonSlurper
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
apply plugin: 'com.android.library'
boolean exoplayer = false, cache = false, auto = false;
boolean dash = false, hls = false, smoothstreaming = false;
File file = file('../../../track-player.json')
if(file.exists()) {
def json = new JsonSlurper().parseText(file.text)
cache = json.cache ?: cache
dash = json.dash ?: dash
hls = json.hls ?: hls
smoothstreaming = json.smoothstreaming ?: smoothstreaming
auto = json.auto ?: auto
exoplayer = json.exoplayer || dash || hls || smoothstreaming
}
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 16 // RN's minimum version
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
consumerProguardFiles 'proguard-rules.txt'
}
buildTypes {
buildTypes.each {
def autoMd = auto ? 'com.google.android.gms.car.application' : 'disabled.car.application'
it.manifestPlaceholders = [autoMetadata: autoMd]
}
}
}
repositories {
maven {
// As RN is not updated in jcenter anymore, we'll have to grab it from npm
url "../node_modules/react-native/android"
}
mavenCentral()
jcenter()
}
dependencies {
//noinspection GradleDynamicVersion
compile 'com.facebook.react:react-native:+'
// ExoPlayer Core
if(exoplayer) {
compile 'com.google.android.exoplayer:exoplayer-core:r2.4.3'
} else {
provided 'com.google.android.exoplayer:exoplayer-core:r2.4.3'
}
// ExoPlayer DASH
if(dash) {
compile 'com.google.android.exoplayer:exoplayer-dash:r2.4.3'
} else {
provided 'com.google.android.exoplayer:exoplayer-dash:r2.4.3'
}
// ExoPlayer HLS
if(hls) {
compile 'com.google.android.exoplayer:exoplayer-hls:r2.4.3'
} else {
provided 'com.google.android.exoplayer:exoplayer-hls:r2.4.3'
}
// ExoPlayer SmoothStreaming
if(smoothstreaming) {
compile 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.3'
} else {
provided 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.3'
}
// Caching (for the default Android player)
if(cache && !exoplayer) {
compile 'com.danikula:videocache:2.7.0'
} else {
provided 'com.danikula:videocache:2.7.0'
}
// Make sure we're using at least the support library 23.2.0, not 23.0.1
compile 'com.android.support:appcompat-v7:23.2.0'
implementation 'com.android.support:support-media-compat:26.+'
compile 'com.android.support:support-v4:27.0.0'
}
I'm using RN 0.55.2 and Track Player v0.2.5
@khoinv is correct, I just did yarn remove react-native-track-player and then yarn add [email protected] and my app compiles now no need to relink anything
With react-native 0.56.0 track-player work well.
This should be resolved with the latest release v.1.0.0
Most helpful comment
hey @yogeshmoradiya121 here's my RNTrackPlayer's gradle file:
I'm using RN 0.55.2 and Track Player v0.2.5