How to set building SDK in Android Studio 1.0? - android-studio

I'm trying to import an eclipse project to Android studio 1.0.
First I get this message:
Error:failed to find target android-19 : ...\Android\sdk
Install missing platform(s) and sync project
But I don't want to install SDK 19, so I use F4 key on module to open settings, but then I get:
Error:(18) A problem occurred evaluating root project '2TVSSA-Library'.
Could not find method android() for arguments [build_9n8e326ws1pb1ogxq6eh7vjg0$_run_closure3#4815ddf5] on root project '2TVSSA-Library'.
I just downloaded Android Studio 1.0, but it tells me android() is missed? Does anyone know what I'm doing wrong?
Thanks!

The problem was an auto-created or imported module in the project. I can't modify the building SDK in root, since it does not have apply plugin: 'com.android.library'.
Change sub-module's build.gradle's android->compleSdkVersion solved the problem.

Related

Android studio is giving the following error when I am trying to build a ionic project "Gradle sync failed: Sync failed: reason unknown"

I am trying to build a ionic project in Android studio on Ubuntu 20.04 . I am using the command ionic capacitor build then android studio opens up as expected then it shows this error Gradle sync failed: Sync failed: reason unknown. I am unable find a solution for this particular gradle sync error. I have reinstalled Ubuntu and other things but still the problem persists.
In my case, a fresh install of Android Studio resulted in Android 31 being the only SDK available but the project was targeting Android 30. I went to Tools > SDK Manager and made sure the appropriate version of Android SDK was installed and available. After restarting, and allowing the gradle sync to complete I was able to build/run the app on a virtual device, etc.
Here is what I found
This is the screenshot thanks for helping.
Capacitor lets you manage your own Android project. Like any IDE-backed project, sometimes things get so out of sync that the only solution is to rebuild the project.
To do this, follow these steps:
Copy any source code you created (such as Java files in app/android/src, manifest files, or resource files) into a safe location outside of app/android.
Next, make sure you are running an updated version of the Capacitor CLI:
npm install #capacitor/cli#latest
Remove the android directory:
rm -rf android/
Re-create the Android app from Capacitor:
npx cap add android
Copy your saved source files back into the project.
Check the error log. You should find something like "Module: 'mobile' platform 'android-30' not found" or something similar. Click Tools > SDK Manager and download the appropriate Android SDK Platform package.
on top right you will see option to view log file upon clicking there you will redirect to file manager and open idea file there
example :
open idea file and scroll down you will see actual issue.
In my case android sdk 31 was not installed.
I installed android sdk 31 from File>Settings>Apprearance and behaviour>system settings>android sdk and install required android sdk and rebuild the project.
accord to my observation in most cases you get this error because you have not required sdk installed in your system.

Android Studio cannot resolve nested imports in dart files

To explain my problem with an example:
I added the dart package carousel_slider to my Flutter project. According to the package documentation, all that's needed to use the package is
import 'package:carousel_slider/carousel_slider.dart';
This file is importing related files on its own, like carousel_controller.dart and carousel_options.dart. However, my Android Studio cannot resolve these imports and says "Undefined class 'CarouselController'" when I try to use CarouselController without explicitly importing the respective dart file myself.
How can I tell my Android Studio to resolve these "nested" imports?
It seems, there was an issue with the version of the package I had installed.
At first, I had ^2.0.0 in my pubspec. So I hardcoded it to 2.2.1 and ran flutter pub upgrade and now Android Studio resolves everything properly.

Gradle Sync Failed in Android Studio 3.6 Cause invalid type code :85

I just update my Android Studio from version 3.5.3 to 3.6, now I open any project I see this error and gradle doesn't sync
I was having the same issue. I solved it by changing the JDK version I was using which was JDK 13.
Go to File -> Project Structure.
On the left side, click on SDK Location and go to JDK Location.
Change it to the Embedded JDK that comes with Android Studio.
Click on OK.
I found out that some people might use Android 4.0 with Java 14 and Gradle 6.1.1 like me. And they are not supported for each other, so just update Gradle to 6.5.1; it will solve the problem. To update Gradle, click in the Android Studio tab: File -> Project Structure -> Project. Then, change the Gradle version to 6.5.1.
Thanks, it was very helpfull!
Here's what I did to solve the issue with JDK 11 + Android 4.0.
Follow Tran's answer (https://stackoverflow.com/a/62967378/5359328) and upgrade to Gradle 6.5.1.
Build project. It still shows the same error.
Change JDK to 8 in Project Structure, build. It's successful.
Change JDK back to 11 in Project Structure, build. It's successful again.

Getting error while importing my old project to Android studio 2.0

I just download the latest Android studio and trying to import my old project which was good with the last version. But I am getting
Error:org.gradle.tooling.BuildActionExecuter.withCancellationToken(Lorg/gradle/tooling/CancellationToken;)Lorg/gradle/tooling/BuildActionExecuter;
I am also getting this error when I am creating new projects.
Any suggestion to solve this problem?
Method : 1.
1.Close Android Studio
2.go to android-studio/plugins/gradle/lib
3.Delete (or better move them somewhere to have a backup) all
gradle-*-1.8 files
Start Android Studio again and rebuild/refresh.
It should work
Method : 2.
Choose another path of gradle in:
File --> settings --> Build,Execution --> Build Tools --> Gradle
If you use of ver 2 select path of installed android studio and select gradle Folder.
I just deleted all the file from my install directory and re-extracted the file, the problem gone.

ARToolKit ARSimpleProj Error

When I open the ARSimpleProj in Android Studio and try to update the gradle version I get this message:
Failed to update the version of the Android Gradle plugin.
Please click 'OK' to perform a textual search and then update the build files manually.
After this, I'm getting this error:
Error:(58, 0) Gradle DSL method not found: 'android()'
Possible causes:
* The project 'ARSimpleProj' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). Fix plugin version and sync project
* The project 'ARSimpleProj' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
* The build file may be missing a Gradle plugin. Apply Gradle plugin.
I tried removing the android->buildToolsVersion and dependencies tag from the top-level, build.gradle file (as indicated in the AS_Migration document) but still it doesn't work.
I finally make it work. When opening the project on the Android Studio, I select "Remind me later" to the Android Gradle Plugin Update recommendation. After this, I could execute and install the application on my cell phone.
Make sure you are using JDK 1.7 in Project Structure. I had problems when using the JDK 1.8 with ARToolkit for Android.

Resources