The line
Caused by: java.lang.IllegalStateException: ScrollView can host only one direct child
in the stack trace gives a hint that in the application of package grass.mary.newApp
you are using a ScrollView
with more than one child.
Remember that according to the docs of ScrollView
:
... Scroll view may have only one direct child placed within it. ...
To sovle this, you may put all your children into a LinearLayout
with vertical orientation and then put the LinearLayout
into the ScrollView
.
Also note that you should take care of your application's package name inside the manifest file. According to the App Manifest Overview:
... once the APK is compiled, the package attribute also represents your app's universally unique application ID.
And, as far as I know, the package name in the manifest should be the same with the Gradle's gradle.build
module file (in the constant named applicationId
). You may read the corresponding page on changing the id for more information.
Another thing to note is that, in Android, you are not only using the Java/Kotlin coded files, but also numerous XML files such as those under the res
directory of your project. In your case, if you are just setting the content view with setContentView
in your main entry point's Activity
and you are using a layout from the R
class to set it, then the problem with the ScrollView
may rely on the fact that the corresponding layout (such as for example res/layout/activity_main.xml
) uses a ScrollView
with multiple elements (instead of only one) and that's probably why you are seeing this exception.
Edit 1:
Now you have updated your question, seems like the problem may be relevant to this other question. Can you check it out and tell us if the given answers on that post solved the problem?
Basically what they suggest is that maybe you did not allocate enough RAM and/or space for your emulated device (ie the device has already many applications in it and cannot install more, unless you wipe the data or increase the space or uninstall some stuff first).
If that doesn't work, the other suggested solution on that post is that you should edit the installation configurations. Be aware here that they are talking about Android Studio version 3.5.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…