react-native-bluetooth-escpos-printer
react-native-bluetooth-escpos-printer copied to clipboard
Can't build apk - react-native-bluetooth-escpos-printer
Execution failed for task ':react-native-bluetooth-escpos-printer:compileReleaseJavaWithJavac'.
Never tested with build tool 28
发自我的 iPhone
在 2019年8月28日,上午11:08,esaputra95 [email protected] 写道:
Execution failed for task ':react-native-bluetooth-escpos-printer:compileReleaseJavaWithJavac'.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
I built apk with build tool 28. Maybe check in node_modules/react-native-bluetooth-escpos-printer and check android/build.gradle. There you find the gradle version (com. android.tools.build:gradle:3.2.1). I use 3.2.1 .
Did you manage to solve it? I have this problem
Same problem here. Hey, @januslo can you give us any tip? Thanks.
I have the same issue, the app is ready, i just need to build it. It runs the debug version with no problem, but i can't build
Alrigth i managed to make it work
I've followed Igor Assis's comment on this issue thread: https://github.com/januslo/react-native-bluetooth-escpos-printer/issues/37
Go to the dependency build.gradle folder YOUR_PROJECT/node_modules/react-native-bluetooth-escpos-printer/android/build.gradle
and update the Compile SDK version and Build Tools Version to match your project's
that worked for me ✌️
@TramontaG ideally you shouldn't be editing the node_modules files directly. If changing the build tools version on the lib project solves the problem I think the better thing to do would be change this on the project and open a PR or even maintain your own version of the project. In my case building the apk directly on the Android Studio solved the problem for me.
This is what I did to solve it:
npx jetify
npx react-native bundle --dev true --platform android --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res
cd android && ./gradlew assembleDebug
Same error happen to me as well. I've tried all method above and still the same issue persist.
I just change buildToolVesion and compileSdkVersion
Go to the dependency build.gradle folder YOUR_PROJECT/node_modules/react-native-bluetooth-escpos-printer/android/build.gradle
and my react-native version
"react": "17.0.2", "react-native": "0.68.2",
`buildscript {
repositories {
jcenter { url "https://jcenter.bintray.com/" }
maven {url "https://repo.spring.io/plugins-release/"}
mavenCentral()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com'
}
}
dependencies {
// classpath 'com.android.tools.build:gradle:3.1.4'
classpath("com.android.tools.build:gradle:7.0.4")
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion = 21
targetSdkVersion = 31
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
sourceSets {
main {
aidl.srcDirs = ['src/main/java']
}
}
}
repositories {
jcenter { url "https://jcenter.bintray.com/" }
maven {url "https://repo.spring.io/plugins-release/"}
mavenCentral()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation group: 'com.android.support', name: 'support-v4', version: '27.0.0'
implementation "com.google.zxing:core:3.3.0"
}
`
Alrigth i managed to make it work
I've followed Igor Assis's comment on this issue thread: #37
Go to the dependency build.gradle folder
YOUR_PROJECT/node_modules/react-native-bluetooth-escpos-printer/android/build.gradle
and update the Compile SDK version and Build Tools Version to match your project'sthat worked for me ✌️
this worked for me and make sense to try
thanks @TramontaG