Wednesday, August 26, 2015

Android Issues With Solutions

  •  Android Studio Error:Execution failed for task ':doctor:dexDebug'.
    > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 1
           Answers : 

           Desccription : Android Studio ran out of memory, try increasing the memory size in

           Build.Gradul  File : 

          android {
               //Additionally you may want to add 
                dexOptions {
                     incremental true        
                      javaMaxHeapSize "4g" 
                            } 
             } 

  • Error inflating class and android.support.v7.widget.CardView
      eclipse


Go to File -> Import -> Existing Android code into workspace --> Browse (Go to sdk/extras/android/support/v7/cardview) --> Click ok --> Click Finish

Your project explorer will now show cardview as a project.

Right click on cardview project --> Properties --> Android(Left Pane) --> Enable isLibrary (tick the checkbox) --> Apply --> ok

Now Right click on your project --> Properties --> Android(Left pane) --> Add (under library) --> cardview --> apply --> ok

Now right click on your project again --> build path --> configure build path --> Under projects tab, add cardview


 android studio

When you want to use support library for Recyclerview or CardView in lower API devices, you not only needs to import the v7 library, but also needs to import Recycler View and Card View support independently.

Like this:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.+'
    compile 'com.android.support:cardview-v7:21.0.+'
    compile 'com.android.support:recyclerview-v7:21.0.+'
    compile 'com.android.support:support-v4:21.0.0'
} 
This is noted by Google's documents here: https://developer.android.com/training/material/compatibility.html


No comments:

Post a Comment