Coder Social home page Coder Social logo

Comments (20)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
Thanks for the report.  I will investigate what is involved in getting 
AndroidSVG to compile with Android Studio.

Original comment by [email protected] on 8 Apr 2014 at 10:33

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 8 Apr 2014 at 7:24

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 9 Apr 2014 at 4:16

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 16 Apr 2014 at 3:59

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
Is there an update on this issue?

Original comment by [email protected] on 17 May 2014 at 8:24

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 17 Jun 2014 at 7:47

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 17 Jun 2014 at 7:56

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024

Original comment by [email protected] on 17 Jun 2014 at 8:04

  • Changed state: Accepted

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
You don't want to introduce a gradle build script? 

Original comment by [email protected] on 17 Aug 2014 at 9:13

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 5 Sep 2014 at 7:39

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 19 Oct 2014 at 6:19

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 20 Oct 2014 at 7:18

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 22 Oct 2014 at 9:33

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 24 Oct 2014 at 5:03

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
Was that comment intended for issue 33?

Original comment by [email protected] on 24 Oct 2014 at 5:21

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 26 Oct 2014 at 7:14

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
Is this issue already really solved? I found out how to make it work, in few 
easy and painless steps.

Original comment by [email protected] on 31 Mar 2015 at 5:42

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
Having the same issue. Android 5.1, Android Studio 1.1.0.

Original comment by [email protected] on 24 Apr 2015 at 12:01

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
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 [email protected] on 19 May 2015 at 9:33

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 23, 2024
I had the same issue decribed in this post. Eventually I fixed it like 
described in #14. To do so I had to do the following (using AndroidStudio): 
1. remove the library
2. checkout the androidsvg source
3. create a new project with "Import Project"
4. include it in my own project by "Import Module"
5. Rightclick on my applications top-folder in the Android-Tree and select 
"Open Module Settings"
6. Adding AndroidSVG in the "Dependencies"-tab as a module
7. Changing 'reference|string' to 'string' in androidsvg/res/values/attrs.xml
8. Rebuilding

-------

Keep in mind to add the 
'xmlns:svgimageview="http://schemas.android.com/apk/res-auto"' line to a parent 
layout of your SVGImageView and to always use the full identifier 
"com.caverock.androidsvg.SVGImageView" when referencing the SVGImageView from a 
layout.

Original comment by [email protected] on 7 Jul 2015 at 2:14

from androidsvg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.