Android build defaults to web #3573
-
Hi folks! I've created a simple React + Typescript + Capacitor project (https://github.com/ThaisRobba/react-ts-capacitor). Any attempt to use plugins or check to see if it is Native, when running in an Android emulator, returns import React from "react";
import ReactDOM from "react-dom";
import { Capacitor } from "@capacitor/core";
const App = () => {
function onClick() {
if (Capacitor.isNative) {
console.log("IS NATIVE!!!");
} else {
console.log("NOT NATIVE");
}
}
return (
<div>
<p>hello2</p>
<button onClick={onClick}>Native???</button>
</div>
);
};
ReactDOM.render(<App />, document.getElementById("root")); Always return "NOT NATIVE!" in Android emulator (running Android 9.0 with 30.0.2 platform tools). Any clues on what could be wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Capacitor gets injected in the https://capacitorjs.com/docs/getting-started#adding-capacitor-to-an-existing-web-app |
Beta Was this translation helpful? Give feedback.
Capacitor gets injected in the
<head>
tag and your app don't have a<head>
taghttps://capacitorjs.com/docs/getting-started#adding-capacitor-to-an-existing-web-app