zakariachowdhury / androidsvg

Automatically exported from code.google.com/p/androidsvg
0 stars 0 forks source link

Impossible to include with Android Studio #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When I try to add this library to Android Studio I follow the following method:

1. Download zip of androidsvg lib
2. Unzip
3. (From Android Studio) File -> Import Project...
4. Select the proper input folder
5. Select the proper output folder
6. Leave all settings checked as default

When the importation ends, the androidsvg package still does not appear in the 
interface and no errors are reported.

Original issue reported on code.google.com by fabioloc...@gmail.com on 8 Apr 2014 at 10:15

GoogleCodeExporter commented 9 years ago
Thanks for the report.  I will investigate what is involved in getting 
AndroidSVG to compile with Android Studio.

Original comment by paul.leb...@gmail.com on 8 Apr 2014 at 10:33

GoogleCodeExporter commented 9 years ago
Thankyou :)
I'm able to add androidsvg in gradle (compile 'com.caverock:androidsvg:1.2.1'), 
but this does not allow me to insert SVGImageView objects in layouts :(

Original comment by fabioloc...@gmail.com on 8 Apr 2014 at 7:24

GoogleCodeExporter commented 9 years ago
This page may be helpful.

http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Dependencies-
Android-Libraries-and-Multi-project-setup

Original comment by paul.leb...@gmail.com on 9 Apr 2014 at 4:16

GoogleCodeExporter commented 9 years ago
Same problem. The artifact must be deployed as an aar on Maven central or we 
can't access R.java and nothing can be referenced from the xml resources.

Original comment by romain.p...@gmail.com on 16 Apr 2014 at 3:59

GoogleCodeExporter commented 9 years ago
Is there an update on this issue?

Original comment by pragmat...@gmail.com on 17 May 2014 at 8:24

GoogleCodeExporter commented 9 years ago
You have to use the ImageView version, not the custom ImageView referencing R 
which is not accessible from jar file as mentioned above

Original comment by mineus....@gmail.com on 17 Jun 2014 at 7:47

GoogleCodeExporter commented 9 years ago
Just FYI

I have built an aar version of the latest beta release.  There are still some 
issues around it though, so I haven't officially announced it.

It can be fetched from the maven central repo if you are keen to try it out.

Original comment by paul.leb...@gmail.com on 17 Jun 2014 at 7:56

GoogleCodeExporter commented 9 years ago

Original comment by paul.leb...@gmail.com on 17 Jun 2014 at 8:04

GoogleCodeExporter commented 9 years ago
You don't want to introduce a gradle build script? 

Original comment by mar...@greenrobot.de on 17 Aug 2014 at 9:13

GoogleCodeExporter commented 9 years ago
This is not actually an issue. In your build.gradle, on the same level as:

apply plugin: 'com.android.application'

add:

repositories{
    mavenCentral()
}

And in your dependencies include:

compile group: 'com.caverock', name: 'androidsvg', version: '1.2.1'

Original comment by johnelli...@gmail.com on 5 Sep 2014 at 7:39

GoogleCodeExporter commented 9 years ago
Does anyone have a working example of this in android studio?  I've tried 
adding the jar to libs as well as the compile group option above.

With both of those, I'ved tried using a custom view, which we all know doesn't 
work.  I tried using a view as <com.caverock.androidsvg.SVGImageView> as well, 
and everything gives me the R.styleable exception.

Original comment by gary.kra...@gmail.com on 19 Oct 2014 at 6:19

GoogleCodeExporter commented 9 years ago
I have this working perfectly though I'm not using the lib as intended.
The way I have it set up is through a library sub-project and then simply add 
androidSVG to the directory structure.

My usage then differs though: I replace all standard images with .svg files and 
use a custom LayoutInflater subclass to properly load them into the app. 

I can't say much about SVGImageView though other that it isn't in the design 
widgets view.

Original comment by jure.erz...@gmail.com on 20 Oct 2014 at 7:18

GoogleCodeExporter commented 9 years ago
It seems like these problems will all be solved thanks to Android 5.0 (API v21) 
http://developer.android.com/reference/android/graphics/drawable/VectorDrawable.
html

Original comment by fabioloc...@gmail.com on 22 Oct 2014 at 9:33

GoogleCodeExporter commented 9 years ago
I was able to get it working in Android Studio. After some trial and error, I 
found the source of the NoClassDefFoundError R.styleable. For some reason, AS 
doesn't like the format of 'reference|string' for the 'svg' attribute. I ran my 
app after changing the format of 'svg' to simply 'string', and no longer 
received a NoClassDefFoundError, and the SVG displayed as expected. 
Interestingly, I changed the format back to 'reference|string', and the project 
continues to run fine. Seems like an IDE issue, as SVGImageView doesn't appear 
to even be using use the fully qualified R.java.

Here's what I'm using:
Android Studio 0.8.13
Android SDK build tools 21.0.2
Emulator running Android 4.2.2 x86

Original comment by sortofri...@gmail.com on 24 Oct 2014 at 5:03

GoogleCodeExporter commented 9 years ago
Was that comment intended for issue 33?

Original comment by paul.leb...@gmail.com on 24 Oct 2014 at 5:21

GoogleCodeExporter commented 9 years ago
It was intended for post #11 and anyone else who may have a problem using the 
library in Android Studio. But, yea it is the solution I found for my post in 
issue 33. Sorry for any confusion. I'll link this thread now.

Original comment by sortofri...@gmail.com on 26 Oct 2014 at 7:14

GoogleCodeExporter commented 9 years ago
Is this issue already really solved? I found out how to make it work, in few 
easy and painless steps.

Original comment by jgz1...@gmail.com on 31 Mar 2015 at 5:42

GoogleCodeExporter commented 9 years ago
Having the same issue. Android 5.1, Android Studio 1.1.0.

Original comment by TylerPf...@gmail.com on 24 Apr 2015 at 12:01

GoogleCodeExporter commented 9 years ago
Same problem here. 
I'm using gradle to import the lib.

Full stack trace:

E/AndroidRuntime( 2805): java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.prudencio.svg/com.prudencio.svg.MainActivity}: 
android.view.InflateException: Binary XML file line #11: Error inflating class 
com.caverock.androidsvg.SVGImageView
E/AndroidRuntime( 2805):    at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
E/AndroidRuntime( 2805):    at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
E/AndroidRuntime( 2805):    at 
android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime( 2805):    at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
E/AndroidRuntime( 2805):    at 
android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 2805):    at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 2805):    at 
android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 2805):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 2805):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 2805):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 2805):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime( 2805): Caused by: android.view.InflateException: Binary XML 
file line #11: Error inflating class com.caverock.androidsvg.SVGImageView
E/AndroidRuntime( 2805):    at 
android.view.LayoutInflater.createView(LayoutInflater.java:633)
E/AndroidRuntime( 2805):    at 
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
E/AndroidRuntime( 2805):    at 
android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
E/AndroidRuntime( 2805):    at 
android.view.LayoutInflater.inflate(LayoutInflater.java:504)
E/AndroidRuntime( 2805):    at 
android.view.LayoutInflater.inflate(LayoutInflater.java:414)
E/AndroidRuntime( 2805):    at 
android.view.LayoutInflater.inflate(LayoutInflater.java:365)
E/AndroidRuntime( 2805):    at 
android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateI
mplV7.java:249)
E/AndroidRuntime( 2805):    at 
android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:1
06)
E/AndroidRuntime( 2805):    at 
com.prudencio.svg.MainActivity.onCreate(MainActivity.java:14)
E/AndroidRuntime( 2805):    at 
android.app.Activity.performCreate(Activity.java:5933)
E/AndroidRuntime( 2805):    at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 2805):    at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
E/AndroidRuntime( 2805):    ... 10 more
E/AndroidRuntime( 2805): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 2805):    at java.lang.reflect.Constructor.newInstance(Native 
Method)
E/AndroidRuntime( 2805):    at 
java.lang.reflect.Constructor.newInstance(Constructor.java:288)
E/AndroidRuntime( 2805):    at 
android.view.LayoutInflater.createView(LayoutInflater.java:607)
E/AndroidRuntime( 2805):    ... 21 more
E/AndroidRuntime( 2805): Caused by: java.lang.NoClassDefFoundError: Failed 
resolution of: Lcom/caverock/androidsvg/R$styleable;
E/AndroidRuntime( 2805):    at 
com.caverock.androidsvg.SVGImageView.init(SVGImageView.java:80)
E/AndroidRuntime( 2805):    at 
com.caverock.androidsvg.SVGImageView.<init>(SVGImageView.java:66)
E/AndroidRuntime( 2805):    ... 24 more
E/AndroidRuntime( 2805): Caused by: java.lang.ClassNotFoundException: Didn't 
find class "com.caverock.androidsvg.R$styleable" on path: DexPathList[[zip file 
"/data/app/com.prudencio.svg-1/base.apk"],nativeLibraryDirectories=[/vendor/lib,
 /system/lib]]
E/AndroidRuntime( 2805):    at 
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime( 2805):    at 
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime( 2805):    at 
java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime( 2805):    ... 26 more
E/AndroidRuntime( 2805):    Suppressed: java.lang.ClassNotFoundException: 
com.caverock.androidsvg.R$styleable
E/AndroidRuntime( 2805):        at java.lang.Class.classForName(Native Method)
E/AndroidRuntime( 2805):        at 
java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime( 2805):        at 
java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime( 2805):        at 
java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime( 2805):        ... 27 more
E/AndroidRuntime( 2805):    Caused by: java.lang.NoClassDefFoundError: Class not 
found using the boot class loader; no stack available

Original comment by eng.prud...@gmail.com on 19 May 2015 at 9:33