MatteoBattilana / WeatherView

WeatherView is an Android Library let you make cool weather animations for your app
Apache License 2.0
514 stars 80 forks source link

Getting this error when include weather view in other activities xml. #14

Closed shubhtrino closed 7 years ago

shubhtrino commented 7 years ago

Unable to start activity ComponentInfo{ android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.github.matteobattilana.weather.WeatherView

magneticflux- commented 7 years ago

@shubhtrino Could you give more of the log (or the entire log) in a Gist please? That snippet doesn't help much.

shubhtrino commented 7 years ago

https://gist.github.com/shubhtrino/585f56aed2489a022a868da613f87cfc

On Wed, Nov 8, 2017 at 9:58 PM, Mitchell Skaggs notifications@github.com wrote:

@shubhtrino https://github.com/shubhtrino Could you give more of the log (or the entire log) in a Gist please? That snippet doesn't help much.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MatteoBattilana/WeatherView/issues/14#issuecomment-342872415, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad-asDequDIl7kuhaDhkuEmK3I1Vob_cks5s0damgaJpZM4QWn_e .

magneticflux- commented 7 years ago

@shubhtrino Are you using proguard? If so, can you add -keep,includedescriptorclasses com.github.matteobattilana.weather.** to your proguard-rules.pro file and rebuild?

shubhtrino commented 7 years ago

NO not using proguard..

On Wed, Nov 8, 2017 at 10:04 PM, Mitchell Skaggs notifications@github.com wrote:

@shubhtrino https://github.com/shubhtrino Are you using proguard? If so, can you add -keep,includedescriptorclasses com.github.matteobattilana. weather.** to your proguard-rules.pro file and rebuild?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MatteoBattilana/WeatherView/issues/14#issuecomment-342874409, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad-asNmZkt_eCWvba9Yar24Hj7SW7C9Hks5s0dgVgaJpZM4QWn_e .

magneticflux- commented 7 years ago

@shubhtrino Are you absolutely sure you're not using ProGuard or any other shrinking system? That tends to produce this exact type of error.

What version of WeatherView, Android, and Android Studio are you using?

shubhtrino commented 7 years ago

compile 'com.github.MatteoBattilana:WeatherView:2.0.1'

studio 3.0

api 23

On Wed, Nov 8, 2017 at 10:11 PM, Mitchell Skaggs notifications@github.com wrote:

@shubhtrino https://github.com/shubhtrino Are you absolutely sure you're not using ProGuard or any other shrinking system? That tends to produce this exact type of error.

What version of WeatherView, Android, and Android Studio are you using?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MatteoBattilana/WeatherView/issues/14#issuecomment-342876704, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad-asLDNIxUbWPcq35D-R8lCJ3XajgnKks5s0dmzgaJpZM4QWn_e .

magneticflux- commented 7 years ago

@shubhtrino Is your source code on GitHub somewhere? If not, can you upload a .zip of a simple project that also demonstrates this bug? I can debug it much faster with access to source code that reproduces the issue.

shubhtrino commented 7 years ago

[Uploading DemoWeatherApp.zip…]() main.zip

shubhtrino commented 7 years ago

check main.zip

magneticflux- commented 7 years ago

If possible, could you include the Gradle build files and Gradle Wrapper in the zip as well? I want to make sure the build environment is as similar as possible to reproduce the issue.

shubhtrino commented 7 years ago

DemoWeatherApp.zip

shubhtrino commented 7 years ago

whole project source code.

shubhtrino commented 7 years ago

can you please explain me what should i do now ?

On Wed, Nov 8, 2017 at 10:31 PM, Mitchell Skaggs notifications@github.com wrote:

If possible, could you include the Gradle build files and Gradle Wrapper in the zip as well? I want to make sure the build environment is as similar as possible to reproduce the issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MatteoBattilana/WeatherView/issues/14#issuecomment-342883512, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad-asEDsJYxXM_CxcXYX3nLKE1ADxBcIks5s0d5VgaJpZM4QWn_e .

magneticflux- commented 7 years ago

@shubhtrino Could you confirm that updating to 2.0.2 fixes the issue? If it didn't work, I'll reopen this.

shubhtrino commented 7 years ago

No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.example.shubh.yahooweather-2/split_lib_dependencies_apk.apk)

now getting this error

shubhtrino commented 7 years ago

after upgrading to 2.02

magneticflux- commented 7 years ago

Could you post the full error?

shubhtrino commented 7 years ago

FATAL EXCEPTION: main Process: com.example.shubh.yahooweather, PID: 4178 java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.example.shubh.yahooweather-2/split_lib_dependencies_apk.apk) at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119) at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208) at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:110) at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38) at android.support.v7.widget.AppCompatTextView.(AppCompatTextView.java:81) at android.support.v7.widget.AppCompatTextView.(AppCompatTextView.java:71) at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103) at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024) at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:746) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:378) at android.widget.ArrayAdapter.getView(ArrayAdapter.java:369) at android.widget.AbsListView.obtainView(AbsListView.java:2405) at android.widget.ListView.makeAndAddView(ListView.java:1909) at android.widget.ListView.fillDown(ListView.java:723) at android.widget.ListView.fillFromTop(ListView.java:784) at android.widget.ListView.layoutChildren(ListView.java:1712) at android.widget.AbsListView.onLayout(AbsListView.java:2201) at android.view.View.layout(View.java:16833) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16833) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16833) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16833) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16833) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2680) at android.view.View.layout(View.java:16833) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2474) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2131) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1233) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6552) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:919) at android.view.Choreographer.doCallbacks(Choreographer.java:710) at android.view.Choreographer.doFrame(Choreographer. 11-08 23:16:49.141 4178-4192/com.example.shubh.yahooweather I/ActivityThreadEui: schedulePauseActivity com.example.shubh.yahooweather.MainActivity finished=true userLeaving=false configChanges=0 dontReport=false 11-08 23:16:57.572 4178-4178/com.example.shubh.yahooweather I/Process: Sending signal. PID: 4178 SIG: 9

magneticflux- commented 7 years ago

Could you update your support libraries and compile version to 27? The latest support libraries are 27.0.0. Using the older 26.1.0 libraries causes that error for my build.

magneticflux- commented 7 years ago

And also make sure to clean the project beforehand because sometimes Android leaves some old dependencies behind which can cause dexing errors.

shubhtrino commented 7 years ago

i just updated support libraries then app is compiling but its not showing anything .<com.github.matteobattilana.weather.WeatherView

android:id="@+id/weather_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:angle="-3"
app:fadeOutTime="1000"
app:fps="40"
app:lifeTime="2200"
app:numParticles="55"
app:orientationMode="ENABLE"
app:startingWeather="RAIN"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

this is what i have included

On Wed, Nov 8, 2017 at 10:06 PM, shubham gaikwad shubhdgaikwad@gmail.com wrote:

NO not using proguard..

On Wed, Nov 8, 2017 at 10:04 PM, Mitchell Skaggs <notifications@github.com

wrote:

@shubhtrino https://github.com/shubhtrino Are you using proguard? If so, can you add -keep,includedescriptorclasses com.github.matteobattilana.weather.** to your proguard-rules.pro file and rebuild?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MatteoBattilana/WeatherView/issues/14#issuecomment-342874409, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad-asNmZkt_eCWvba9Yar24Hj7SW7C9Hks5s0dgVgaJpZM4QWn_e .

shubhtrino commented 7 years ago

not showing any effect .

On Wed, Nov 8, 2017 at 11:32 PM, shubham gaikwad shubhdgaikwad@gmail.com wrote:

i just updated support libraries then app is compiling but its not showing anything .<com.github.matteobattilana.weather.WeatherView

android:id="@+id/weather_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:angle="-3"
app:fadeOutTime="1000"
app:fps="40"
app:lifeTime="2200"
app:numParticles="55"
app:orientationMode="ENABLE"
app:startingWeather="RAIN"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

this is what i have included

On Wed, Nov 8, 2017 at 10:06 PM, shubham gaikwad shubhdgaikwad@gmail.com wrote:

NO not using proguard..

On Wed, Nov 8, 2017 at 10:04 PM, Mitchell Skaggs < notifications@github.com> wrote:

@shubhtrino https://github.com/shubhtrino Are you using proguard? If so, can you add -keep,includedescriptorclasses com.github.matteobattilana.weather.** to your proguard-rules.pro file and rebuild?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MatteoBattilana/WeatherView/issues/14#issuecomment-342874409, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad-asNmZkt_eCWvba9Yar24Hj7SW7C9Hks5s0dgVgaJpZM4QWn_e .

magneticflux- commented 7 years ago

Those xml attributes do not do anything anymore, they only were used in the old version. To start an effect, you must call the setWeatherData method and also have the WeatherView on a dark background because the particles are white.

shubhtrino commented 7 years ago

Can you please give some snapshot about that.

magneticflux- commented 7 years ago

I have a working version of your demo app here: DemoWeatherApp.zip.

Do you mean a note about those changes in the migration section of the readme?

shubhtrino commented 7 years ago

Thank you very much . Its completely working fine now.

magneticflux- commented 7 years ago

Glad to have helped!

shubhtrino commented 6 years ago

hello ,I am having a problem enabling orientation in weatherview in Java, could you please guide me in this...

On Thu, Nov 9, 2017 at 12:35 AM, Mitchell Skaggs notifications@github.com wrote:

Glad to have helped!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MatteoBattilana/WeatherView/issues/14#issuecomment-342925136, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad-asA_zews1fZ5MUXIB8_XP8NszkSgMks5s0ftmgaJpZM4QWn_e .

magneticflux- commented 6 years ago

@shubhtrino Have you looked at the sample app? You have to use the WeatherViewSensorEventListener to convert gyroscope data to the WeatherView. Did you remember to call start() on the event listener in the onResume() method of the Activity/Fragment and stop() in the onPause() method?