I am having problems generating apks (and building in general) off android studio.
My application is built with Next.JS 14.1.4 and capacitor 6.
What i have tried
I have run the following steps multiple times:
- close android studio
- delete android folder
- run
npm run build
- run
npx cap add android
- run
npx cap sync
- cleared android cache
- sync project with gradle files
Update both gradle/AGP as suggested by android studio.
Modified gradle.properties like so
org.gradle.jvmargs=-Xmx4608m -Dfile.encoding=UTF-8
Added multiDexEnabled true
in build.gradle
Added buildTypes.release.crunchPngs false
in build.gradle
Nothing of the above changed the error i am getting
This is the error i get when i try to build the project
This is my project configuration
next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {
distDir: "out",
generateBuildId: async () => {
// This could be anything, using the latest git hash
return "ciaoooo";
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**",
},
],
},
};
export default nextConfig;
capacitor.config.ts
import { CapacitorConfig } from "@capacitor/cli";
const config: CapacitorConfig = {
appId: "com.timing.app",
appName: "timing",
backgroundColor: "#ffffff",
webDir: "out",
server: {
url: "http://xxx.xxx.xxx.xxx:3000",
cleartext: true,
},
};
export default config;
My dependencies
"dependencies": {
"@awesome-cordova-plugins/android-full-screen": "^6.7.0",
"@capacitor/android": "^6.0.0",
"@capacitor/core": "^6.0.0",
"@hookform/resolvers": "^3.3.4",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-slot": "^1.0.2",
"byte-base64": "^1.1.0",
"chart.js": "^4.4.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cmdk": "^1.0.0",
"cordova-plugin-fullscreen": "^1.3.0",
"fetch-intercept": "^2.4.0",
"geopattern": "^1.2.3",
"jetifier": "^2.0.0",
"lucide-react": "^0.372.0",
"next": "14.1.4",
"react": "^18",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18",
"react-hook-form": "^7.51.3",
"react-icons": "^5.0.1",
"react-toastify": "^10.0.5",
"sass": "^1.72.0",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.0",
"zod": "^3.23.3",
"zustand": "^4.5.2"
},
"devDependencies": {
"@capacitor/cli": "^6.0.0",
"@types/geopattern": "^1.2.9",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.4.19",
"eslint": "^8",
"eslint-config-next": "14.1.4",
"postcss": "^8",
"tailwindcss": "^3.4.3",
"typescript": "^5"
}