3

I used to work with Android Studio bundle 162.3871768. It was working fine. I just upgraded to bundle 201.6858069 and this is where all the mess started. Now I can't even place views in a layout! The layout itself is grayed out, and when I drag a view onto the layout nothing happens at all. Besides that, there is a warning message reading:

Replace the tag with FragmentContainerView

I just created a brand new navigation drawer app. Here is a screenshot:

Layout editor

And this is the code:

Layout XML

How can I fix this mess?

Edit: after following the warning message and replacing the fragment tag with androidx.fragment.app.FragmentContainerView the warning is gone, but I still can't place any views in the layout.

Edit: after running a build I noticed so many Java errors (cannot resolve symbol ...) which you can see in the below picture:

MainActivity.java

There are also many errors in the console which seem to be telling that some fetch attempts failed:

Execution failed for task ':app:checkDebugAarMetadata'.
- Could not resolve all files for configuration ':app:debugRuntimeClasspath'.  
   - Could not find androidx.appcompat:appcompat:1.2.0.  
     Searched in the following locations:  
       - https://dl.google.com/dl/android/maven2/androidx/appcompat/appcompat/1.2.0/appcompat-1.2.0.pom
       - https://jcenter.bintray.com/androidx/appcompat/appcompat/1.2.0/appcompat-1.2.0.pom  
     Required by:
         project :app
   - Could not find com.google.android.material:material:1.2.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/material/material/1.2.1/material-1.2.1.pom
       - https://jcenter.bintray.com/com/google/android/material/material/1.2.1/material-1.2.1.pom  
     Required by:
         project :app
   - Could not find com.google.android.material:material:1.2.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/material/material/1.2.1/material-1.2.1.pom
       - https://jcenter.bintray.com/com/google/android/material/material/1.2.1/material-1.2.1.pom  
     Required by:
         project :app > androidx.navigation:navigation-ui:2.2.2
   - Could not find androidx.transition:transition:1.0.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/androidx/transition/transition/1.0.1/transition-1.0.1.pom
       - https://jcenter.bintray.com/androidx/transition/transition/1.0.1/transition-1.0.1.pom  
     Required by:
         project :app > androidx.navigation:navigation-ui:2.2.2

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Edit: It seemed like an IP issue. Now the fetches have completed but the Java errors are still there. I ran a successful build but the app crashes when launched. Furthermore I noticed something: this issue only occurs if there is no internet connection while creating the project. This suggests that it has to download some files before creating the project. How can this be tackled? How can I create projects while I am offline?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Wais Kamal
  • 5,858
  • 2
  • 17
  • 36
  • Have you attempted to follow the warning and use a FragmentContainerView? What happens? – micpap25 Dec 07 '20 at 15:52
  • Yes, nothing happened. – Wais Kamal Dec 07 '20 at 15:53
  • Can you be specific? Literally nothing changes? The warning is removed but nothing renders? No new warnings come up? – micpap25 Dec 07 '20 at 16:01
  • 1
    The warning is gone but I still can't place views. I will edit the question. – Wais Kamal Dec 07 '20 at 16:06
  • The errors are usually at the top-right spot with the red warning label. You should see an exception or cause of the error that makes the whole layout gray. Usually this is caused by an outdated build so I first recommend doing a "Clean -> Make Project" then examine the errors on the top-right corner exclamation point with red circle on it at the design editor. – Furkan Yurdakul Dec 08 '20 at 12:48
  • Thank you. After doing this I noticed a bunch of Java errors so I will update the question. – Wais Kamal Dec 09 '20 at 10:54
  • To "create projects while ... offline?" first create a test project while you are still online that uses some minimal pieces of the dependent code and make sure it compiles AND that you build a test APK. Then when you compile your similar project offline everything should be in place. – YinOrYan Dec 12 '20 at 20:12

0 Answers0