Error Over 64K Methods แก้ง่ายมาก!
สวัสดีครับ วันนี้เราก็จะมาพูดถึงเกี่ยวกับ Error Over 64K สาเหตุเกิดจากการเพิ่ม compile ใน Gradle Script มากจนเกินไปจึงทำให้เกิดข้อผิดพลาดในตอน build ได้ คือ a .dex file cannot exceed 64K เราสามารถแก้ได้ง่ายๆดังนี้ครับ
เปิดไฟล์ Gradle Script/build.gradle(Module:app)
จากนั้นก็กด Sync Now
เปิดไฟล์ Gradle Script/gradle.properties แก้ไข org.gradle.jvmargs=-Xmx1536m
สร้างไฟล์ java/MyApplication.java
เพียงเท่านี้เราก็สามารถก็แก้ไขผิดพลาดดังกล่าวได้แล้ว หากมีข้อสงสัยสามารถคอมเมนต์ไว้ได้ที่โพสต์ด้านล่างเลยครับ สำหรับวันนี้ก็ขอลาไปก่อนสวัสดีครับ
เปิดไฟล์ Gradle Script/build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.todo.geekcreator.todosuccess"
minSdkVersion 15
targetSdkVersion 23
versionCode 2
versionName "1.1"
multiDexEnabled true //เพิ่มในส่วนตรงนี้
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.firebase:firebase-ads:10.2.0'
compile 'com.android.support:multidex:1.0.0' //เพิ่มในส่วนตรงนี้
compile 'com.jjoe64:graphview:4.2.1'
testCompile 'junit:junit:4.12'
}
จากนั้นก็กด Sync Now
เปิดไฟล์ Gradle Script/gradle.properties แก้ไข org.gradle.jvmargs=-Xmx1536m
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
สร้างไฟล์ java/MyApplication.java
import android.app.Application;
import android.support.multidex.MultiDex;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
}
}
เพียงเท่านี้เราก็สามารถก็แก้ไขผิดพลาดดังกล่าวได้แล้ว หากมีข้อสงสัยสามารถคอมเมนต์ไว้ได้ที่โพสต์ด้านล่างเลยครับ สำหรับวันนี้ก็ขอลาไปก่อนสวัสดีครับ



riofaAdiego-Kansas City Jeremy Frazier https://marketplace.visualstudio.com/items?itemName=1innaphfi-na.Descargar-Rogue-n-Roll-gratuita-2022
ตอบลบquimapartwor
YumitXsperdo1997 Dai Ojeda https://www.viajerosperrunos.com/profile/Masti-Hindi-Movie-EXCLUSIVE-Free-Download-Utorrent/profile
ตอบลบacesbarnist
Wperraigse Christopher Chartier click here
ตอบลบsetideli
nistinPcishi Ana Greene link
ตอบลบspeedarimout
WinmiFoswa Samantha Allen click
ตอบลบlink
click here
click here
benrobasro
AriamusFin_ga1983 Jen Schuler programs
ตอบลบsite
programs
prohnymningtrad