Android Studio aidl is missing - android-studio

compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "org.xyz.abc"
minSdkVersion 16
targetSdkVersion 21
}
classpath 'com.android.tools.build:gradle:2.2.3'
Error getting -
Error:Execution failed for task ':app:compileDebugAidl'.
java.lang.IllegalStateException: aidl is missing

Change build tool version to "21"
buildToolVersion and compileSdkVersion should be same

Related

Android Studio Unsatisfied linkerror while trying to open.so file

Android Studio 4.0 is installed on my Windows 10 (64-bit) system.
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.qs5501demo.aidl"
minSdkVersion 21
targetSdkVersion 26
multiDexEnabled true
}
on clicking run app button, I got the following error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.qs5501demo.aidl, PID: 4368
java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/~~U7rD8N9mzMhsX2x4MALzmg==/com.qs5501demo.aidl-fQAI7kmWEWiITYxrOd-qQQ==/lib/arm/libzyapi_common.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at android.zyapi.CommonApi.(CommonApi.java:26)
at com.qs.wiget.App.openGPIO(App.java:372)
at com.qs.wiget.App.init(App.java:101)
at com.qs.wiget.App.onCreate(App.java:93)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6607)
at android.app.ActivityThread.access$1300(ActivityThread.java:233)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1896)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
the erro is with libzyapi_common.so file which is in the folder ~\app\src\main\jniLibs\armeabi. Also there is a jar file in ~\app\libs named core.jar. Please someone help me to check if this jar and so files are placed in the correct folders.

Error Android Studio:No dex files created while using Google's Calendar API

apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
applicationId "com.example.calendarquickstart"
minSdkVersion 11
targetSdkVersion 24
versionCode 1
multiDexEnabled true
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'pub.devrel:easypermissions:0.1.5'
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-calendar:v3-rev210-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
}
I am trying to use google API for calendar but I am getting following error while running the app"
Information:Gradle tasks [:app:clean, :app:generateDebugSources,
:app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies,
:app:generateDebugAndroidTestSources, :app:assembleDebug]
Error:Execution failed for task
':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: No dex files
created at
C:\Users\user\AndroidStudioProjects\CalendarQuickstart\app\build\intermediates\transforms\dex\debug\folders\1000\10\guava-jdk5-17.0_bbc68f1b67df2c58337cd00757b7bfd105bb5573"
I am following the steps from this link
What changes need to be done in gradle file for running this app?
Try enabling the multidex support in your build.gradle file as stated in Configuring Your App for Multidex with Gradle:
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Additional reading:
Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536—including Android framework methods, library methods, and methods in your own code. In the context of computer science, the term Kilo, K, denotes 1024 (or 2^10). Because 65,536 is equal to 64 X 1024, this limit is referred to as the '64K reference limit'.
Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration.

Why does my Android Studio 2.0 uses SDK 23 to compile all the time even when I use lower versions

How to change the compile version to sdk 22 without getting errors about appcompat-v7:23.0.0 ?
You can't... appcompat-v7:23.0.0 NEEDS SDK 23.
It's: SDK 22 OR appcompat-v7:23.0.0
*edit, but with this you can set the SDK compartible to what you might need: (does this makes sense?)
gradle.build(Module: app)
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.example.appname"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
}

How to run emulator in real device?

I get an error in running the emulator.
Take a look at my Screenshot.
How can I fix it?
You need to select the device in the list at the top.
It says UNAUTHORIZED which means you should go on the phone and allow debugging from this PC (you should be prompted when you plug in the USB).
If that doesn't work try checking if USB-debugging is enabled and as a last resort allow debugging from any PC (not recommended) in the development settings
As you can see you have to set the emulators minSDK to 19 to run your app...
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Screen Capture
I got the answer.I change the min sdk from 21 to 19 at 'app/build.gradle file'
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"

Run JUnit tests in Android studio

I created new Android Project and tried to run tests (JUnit) and had follow result:
15:28:53: Executing external tasks 'cleanTest test --tests com.binomv.rimidalv.tt.*'...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'TT'.
Could not resolve all dependencies for configuration ':classpath'.
Artifact 'kxml2.jar (net.sf.kxml:kxml2:2.3.0)' not found.
Searched in the following locations:
https://jcenter.bintray.com/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.512 secs
Artifact 'kxml2.jar (net.sf.kxml:kxml2:2.3.0)' not found.
Searched in the following locations:
https://jcenter.bintray.com/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar
But if i use test through device - it is ok.
Thank you.
-----UPDATE-----
build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.binomv.rimidalv.tt"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
}
----- SOLUTION -----
You should remove "~/.gradle" folder. Android Studio recreate it.

Resources