Summary newbie errors/solutions on Android Studio

Summary of my newbie errors/solutions on Android Studio

1. After I update Android Studio and change it's home/cache directory the are 
errors on make
Error:Android Packager: [personal-health-assistant] File (x86)Android_Studio\.AndroidStudioPreview\system\compile-server\personal-health-assistant _4ac1197d\android\intermediate_artifacts\personal-health-assistant \personal-health-assistant.apk.res not found. Try to rebuild project

So I tries all of these
  • rebuild project
  • restart Android studio
  • Invalidate cache
  • Search stack overflow
  • re-config module and build path
  • restart computer
  • Try to create artifacts
The error still occurs.

However, this project still not a gradle based project. The non gradle based projet may not compatible. So I create new project which is gradle based project then I move only java,res,AndroidManifest etc. to this new project.

Now I try to run it again and aapt.exe is crash. After some investigate in stackoverflow I found that aapt.exe may crash by wrong @string references. After I correct all @string aapt.exe won't crash but there are many errors about the R. It seem that the IDE don't know the achartengine library so I try to add it.

The I found an error
Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl

After 3 hrs of search and try to fix this bug. At last I found a clue

This error means there are duplicate ref to single library.
Fortunately, I can remember which module ref to which libs.
So I config build.gradle on every modules that needs libs and now I can run my project! ^^ 

This is an example of my config.

dependencies {
    //compile fileTree(dir: 'libs', include: ['*.jar'])

    compile fileTree(dir: 'libs', include: ['android-support-v4.jar'])
    compile fileTree(dir: 'libs\\achartengine-1.1.0-demo-source\\libs', include: ['achartengine-1.1.0.jar'])

Note : All these errors took more than 8 eight hours from 3 days to solve T^T.


Unable to execute dex: Multiple dex files define
I have 
FaceBookSDK 3.5.2 -> which is referencing android-support-v4
ActionBarSherlock -> which is referencing android-support-v4 but with a modified version to support maps.

To solve the problem I had to make FaceBookSDK library depend on ABS library instead of the support library directly.

If the error still occur try to re-import the project.


Error:Execution failed for task ':sSD:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE
 File 1: C:\Android\androidWorkspace\mtd\sSD\libs\jackson-all-1.9.11.jar
 File 2: C:\Android\androidWorkspace\mtd\sSD\libs\jackson-all-1.9.11.jar

just go to problems file and remove META-INF/LICENSE


Popular posts from this blog

เทคนิค ชนะ เกมเศรษฐี 14 ตารวด!!! ( Let's get Rich )

Using Google Chrome Inspect Element to Analyze the website

Easy way to download whole youtube play list and convert them to mp3