Closed PhoenixAssutech closed 9 months ago
i have the same issue i configured the aidl files and i have minSdkVersion = 21
i'm using react-native: 0.71.7
i have the same issue i configured the aidl files and i have minSdkVersion = 21 i'm using react-native: 0.71.7
Im getting the exact same error. minSdkVersion = 21 compileSdkVersion = 34 targetSdkVersion = 34 react-native: 0.73.2
@geekdroid07 @d-lindau Can you guys give more detail about the code like how are you calling library methods for printing? because it is working with me with react-native 0.71.14 without any issue.
Sunmi V2s react-native-cli: 2.0.1 react-native: 0.71.14 node 20 (also tried node 18) windows 11 buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33
I have now started a brand new project. I have only installed @heasy/react-native-sunmi-printer and changed App.tsx to this:
import React from 'react';
import { SafeAreaView, Button } from 'react-native';
import SunmiPrinter from '@heasy/react-native-sunmi-printer';
async function _printRecieve(text) {
if (text === "print") {
alert("Printing");
try {
await SunmiPrinter.printerText('Hello World\n');
} catch (e) {
// Handle the error here. Using `setState` implies this should be within a class or useState hook
console.error("Printer error: " + e.message);
}
}
}
function App(): JSX.Element {
const handlePrint = () => _printRecieve('print'); // This creates a new function that calls _printRecieve with 'print'
return (
<SafeAreaView>
<Button title="Print" onPress={handlePrint} />
</SafeAreaView>
);
}
export default App;
I get the error on start.
@Rehankhalil462
Update: Started new issue https://github.com/Surile/react-native-sunmi-printer/issues/43
@d-lindau Make sure to add android-manifest.plugin.js file in root folder
const { withAndroidManifest } = require("@expo/config-plugins");
module.exports = function androiManifestPlugin(config) {
return withAndroidManifest(config, async (config) => {
let androidManifest = config.modResults.manifest;
androidManifest.queries.push({
package: {
$: {
"android:name": "woyou.aidlservice.jiuiv5",
},
},
});
return config;
});
};
and add following in app.json
"plugins": [
"./android-manifest.plugin.js",
...restcode
@PhoenixAssutech fixed the issue. Please reinstall the library and then try.