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.

  • Gradle version 2.10 is required it is necessary to feed the version Gradle 2.10 - Barmaley
  • But how to do that? Just change in the properties on the specified path with your hands - Gradle turns 10 minutes and does not synchronize the project. Yes, and this way does not seem logical. Need to update something. What? It is also not clear why the components of 2016 do not work for such "old" teams. - St-St

1 answer 1

Error means that the minimum version of the Gradle collector is required - 2.10 / In addition to the minimum version of the Gradle plugin for Android Studio, the version of Gradle itself also matters.

To install the required version of Gradle, open the branch of gradle files in the left pane of Android Studio and select the gradle-wrapper.properties file, specify the version of the gradle distribution, for example:

 distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 

version 2.14.1 is listed here

gradle

Then sync the project.

You can also make this setting using the Android Studio GUI, see this answer for more details and more information on updating Gradle.

  • Grand Merci. I did everything according to the instructions from the answer, where "using a graphical interface ...". It remains unclear just which line in MainActivity caused such a stir. - St-st
  • @ St-st I think a stir caused your very desire to use VectorDrawable, this requires a gradle version of at least 2.10 and a version of the gradle plugin of at least 2.0.0 - pavlofff
  • Please show me where is VectorDrawable used in MainActivity? The only application icon is in the raster, while it is not even in the MainActivity. Suspicion is caused only by delayed animations, animated transitions between Windows and full-screen mode ("sticky"). - St-St
  • @ St-st It's not even about what's in the MainActivity. In order for the application to start, it must be compiled by the collector (gradle) and compiled. You have declared support for VectorDrawable in the assembler config, but your version of Gradle cannot build this configuration. In stektrais everything is written. - pavlofff