Dear luminaries!
There was the following situation.
When creating the MainActivity, a user from Android version 4.4 got an error java.lang.IllegalStateException (the place is android.support.v7.widget.am.a ).
All stack trace from google:
java.lang.RuntimeException: Unable to start activity ComponentInfo{ΠΏΠ°ΠΊΠ΅Ρ/ΠΏΠ°ΠΊΠ΅Ρ.MainActivity}: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2429) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493) at android.app.ActivityThread.access$800(ActivityThread.java:166) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5590) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1280) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1096) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat. at android.support.v7.widget.am.a(Unknown Source) at android.support.v7.widget.df.b(Unknown Source) at android.support.v7.av<init>(Unknown Source) at android.support.v7.a.ah.<init>(Unknown Source) at android.support.v7.a.aa.<init>(Unknown Source) at android.support.v7.a.ab.<init>(Unknown Source) at android.support.v7.aua(Unknown Source) at android.support.v7.aua(Unknown Source) at android.support.v7.ase(Unknown Source) at android.support.v7.asonCreate(Unknown Source) at cf.i_ya.sales_secrets_demo.MainActivity.onCreate(Unknown Source) at android.app.Activity.performCreate(Activity.java:5447) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2393) ... 11 more I tried to implement the pavlofff advice, long life to him, from another question on ru.stackoverflow: "Apparently, we need to add support for VectorDrawable to the configuration file of the application build.gradle
android { defaultConfig { vectorDrawables.useSupportLibrary = true } } "The same version of the Gradle plugin must be at least 2.xx (build.gradle of the entire project):
dependencies { classpath 'com.android.tools.build:gradle:2.1.0' ... } but Android Stedea demanded from me what I did not understand:
Warning: Gradle version 2.10 is required. Current version is 2.8. If you are using the C: \ android \ AndroidStudioProjects \ project folder \ gradle \ wrapper \ gradle-wrapper.properties to gradle-2.10-all.zip
Before that, my version of Gradle was 1.5.x, and an attempt to feed him 2.8.0 did not succeed. MainActivity code:
public class MainActivity extends AppCompatActivity { SharedPreferences sPref; SharedPreferences.Editor ed; DB db; TextView text_0, text_1, text_2, text_3, text_4, text_5; Animation anim; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ΠΏΠΎΠ»Π½ΠΎΡΠΊΡΠ°Π½Π½ΡΠΉ "Π»ΠΈΠΏΠΊΠΈΠΉ" ΡΠ΅ΠΆΠΈΠΌ lipkiy(); //ΠΏΠΎΠ»ΡΡΠ°Π΅ΠΌ Π΄Π°Π½Π½ΡΠ΅ ΠΈΠ· ΡΠ°ΠΉΠ»Π° "Pref" sPref = getSharedPreferences("Pref", MODE_PRIVATE); ed = sPref.edit(); // ΠΎΡΠΊΡΡΠ²Π°Π΅ΠΌ ΠΏΠΎΠ΄ΠΊΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΠΊ ΠΠ db = new DB(this); db.open(); db . faq_obnovit(); nachalo(); } // ΠΏΡΠΈΠ²Π΅ΡΡΡΠ²ΠΈΠ΅ ΠΈ Π½Π°ΡΠ°Π»ΠΎ ΡΠ°Π±ΠΎΡΡ protected void nachalo() { text_0 = (TextView) findViewById(R.id.text_0); text_1 = (TextView) findViewById(R.id.text_1); text_2 = (TextView) findViewById(R.id.text_2); text_3 = (TextView) findViewById(R.id.text_3); text_4 = (TextView) findViewById(R.id.text_4); text_5 = (TextView) findViewById(R.id.text_5); // ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΠΎΠ±ΡΠ΅ΠΊΡ Π°Π½ΠΈΠΌΠ°ΡΠΈΠΈ ΠΈΠ· ΡΠ°ΠΉΠ»Π° anim/myalpha anim = AnimationUtils.loadAnimation(this, R.anim.myalpha); Thread t = new Thread(new Runnable() { public void run() { try { TimeUnit.SECONDS.sleep(1); runOnUiThread(runn0); TimeUnit.MILLISECONDS.sleep(4000); runOnUiThread(runn1); TimeUnit.SECONDS.sleep(4); runOnUiThread(runn2); TimeUnit.SECONDS.sleep(4); runOnUiThread(runn3); TimeUnit.SECONDS.sleep(4); runOnUiThread(runn4); TimeUnit.SECONDS.sleep(4); runOnUiThread(runn5); TimeUnit.SECONDS.sleep(4); runOnUiThread(runn6); } catch (InterruptedException e) {e.printStackTrace();} } }); t.start(); } Runnable runn0 = new Runnable() { public void run() { // Π·Π°ΠΏΡΡΠΊΠ°Π΅ΠΌ Π°Π½ΠΈΠΌΠ°ΡΠΈΡ text_0.startAnimation(anim); text_0 . setVisibility(View.VISIBLE); } }; Runnable runn1 = new Runnable() { public void run() { // Π·Π°ΠΏΡΡΠΊΠ°Π΅ΠΌ Π°Π½ΠΈΠΌΠ°ΡΠΈΡ text_1.startAnimation(anim); text_1 . setVisibility(View.VISIBLE); } }; Runnable runn2 = new Runnable() { public void run() { // Π·Π°ΠΏΡΡΠΊΠ°Π΅ΠΌ Π°Π½ΠΈΠΌΠ°ΡΠΈΡ text_2.startAnimation(anim); text_2 . setVisibility(View.VISIBLE); } }; Runnable runn3 = new Runnable() { public void run() { // Π·Π°ΠΏΡΡΠΊΠ°Π΅ΠΌ Π°Π½ΠΈΠΌΠ°ΡΠΈΡ text_3.setVisibility(View.VISIBLE); text_3.startAnimation(anim); } }; Runnable runn4 = new Runnable() { public void run() { // Π·Π°ΠΏΡΡΠΊΠ°Π΅ΠΌ Π°Π½ΠΈΠΌΠ°ΡΠΈΡ text_4.startAnimation(anim); text_4 . setVisibility(View.VISIBLE); } }; Runnable runn5 = new Runnable() { public void run() { // Π·Π°ΠΏΡΡΠΊΠ°Π΅ΠΌ Π°Π½ΠΈΠΌΠ°ΡΠΈΡ text_5.startAnimation(anim); text_5 . setVisibility(View.VISIBLE); } }; Runnable runn6 = new Runnable() { public void run() { startActivity(new Intent(MainActivity.this, FAQ.class)); MainActivity.this.finish(); overridePendingTransition(R.anim.alpha_to_1, R.anim.alpha_to_0); } }; protected void onDestroy() { super.onDestroy(); // Π·Π°ΠΊΡΡΠ²Π°Π΅ΠΌ ΠΏΠΎΠ΄ΠΊΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΠΏΡΠΈ Π²ΡΡ
ΠΎΠ΄Π΅ db.close(); } // ΠΏΠΎΠ»Π½ΠΎΡΠΊΡΠ°Π½Π½ΡΠΉ "Π»ΠΈΠΏΠΊΠΈΠΉ" ΡΠ΅ΠΆΠΈΠΌ protected void onStart() { super.onStart(); lipkiy(); } // ΠΏΠΎΠ»Π½ΠΎΡΠΊΡΠ°Π½Π½ΡΠΉ "Π»ΠΈΠΏΠΊΠΈΠΉ" ΡΠ΅ΠΆΠΈΠΌ protected void lipkiy () { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } } There were a few questions: 1. The reason for all the use of animation on Android 4.4? (at 6.0 it works) 2. How to resolve the situation for the better with minimal actions? 3. If it is necessary to finish off the pavlofff offer, what should be done specifically? (if possible, where and what to press :)? )
Perhaps an important note: I have Android Studio version 1.5.2 - and I cannot go higher.
