januslo / react-native-bluetooth-escpos-printer

React-Native plugin for the bluetooth ESC/POS & TSC printers.
MIT License
361 stars 420 forks source link

Can't build apk - react-native-bluetooth-escpos-printer #68

Open esaputra95 opened 5 years ago

esaputra95 commented 5 years ago

Execution failed for task ':react-native-bluetooth-escpos-printer:compileReleaseJavaWithJavac'. Screenshot (15) Screenshot (16) Screenshot (17)

januslo commented 5 years ago

Never tested with build tool 28

发自我的 iPhone

在 2019年8月28日,上午11:08,esaputra95 notifications@github.com 写道:

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.

firdaussoberi commented 5 years ago

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 .

DanelSilas commented 4 years ago

Did you manage to solve it? I have this problem

guilherme-ramalho commented 4 years ago

Same problem here. Hey, @januslo can you give us any tip? Thanks.

TramontaG commented 4 years ago

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

TramontaG commented 4 years ago

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 ✌️

guilherme-ramalho commented 4 years ago

@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.

FranLMSP commented 4 years ago

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
amirulasrof commented 3 years ago

Same error happen to me as well. I've tried all method above and still the same issue persist.

Deepak9811 commented 2 years ago

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"
        }

`

OhFarhan commented 11 months ago

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's

that worked for me ✌️

this worked for me and make sense to try

thanks @TramontaG