OpenCV Library error with AndroidStudio - android

I'm having issues with current Android project I'm working on, It has OpenCV Library imported as Module and set as dependency. After updating Android Studio from 0.8.14 to 1.0, and trying to sync Gradle I'm getting following error:
Error:Library projects cannot set applicationId. applicationId is set
to 'org.opencv' in default config.
I'd like to post my project structure and grade file, but I can't upload images yet.

Try commenting applicationID out of your library module's build.gradle file. Like this:
defaultConfig {
// applicationId "com.library.package"
minSdkVersion 14
targetSdkVersion 21
}
I'm still new at Android Studio, and am by no means an expert, but I got the same error after upgrading and this seems to fix it.

I tried to use comment, but instead to fix it, it generate new error (SOLVED).
With "applicationId 'lecho.lib.hellocharts'" enabled:
Library projects cannot set applicationId. applicationId is set to 'lecho.lib.hellocharts' in default config
With "applicationId 'lecho.lib.hellocharts'" disabled (as comment):
A problem occurred configuring project ':hellocharts-library'.
Exception thrown while executing model rule: org.gradle.api.publish.plugins.PublishingPlugin$Rules#addConfiguredPublicationsToProjectPublicationRegistry(org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectPublicationRegistry, org.gradle.api.publish.PublishingExtension, org.gradle.api.internal.project.ProjectIdentifier)
java.lang.NullPointerException (no error message)
I found solution.

Related

Need help understanding Gradle Build error

This is the first time I've run across an error like this, and it indicates to me that I understand significantly less about Android Studio / Gradle than I thought.
When I run a gradle sync, I receive the following error:
/Users/username/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/65cf0a0160015e9f883c383ac0bd600d/res/values-v26/values-v26.xml
Error:(9, 5) error: resource android:attr/colorError not found.
There are a few other errors thrown, but they're more or less the same.
Part 1) Pulling apart the URL with .gradle/caches/... part of the URL, I can see that I'm trying to build from a version 27 resource (...appcompat-v7-27.1.1.aar...), but within that build there is a values-v26.xml file. That's the first part that is confusing me. Shouldn't they both say the same thing?
Secondly, in my app/build.grade, I have specified that I want to use API version 26:
compileSdkVersion 26
defaultConfig {
applicationId "com.adrichmobile"
minSdkVersion 26
targetSdkVersion 26
....
compile 'com.android.support:appcompat-v7:26.1.0'
Part 2) Why would I be trying to pull from version 27 in the cache? (After clearing the cache, I get the same thing)
It turns out my problem was a common one (with a recent update of react-native), but I was originally searching for things that didn't lead me to this conclusion.
In the end, I had to force my subprojects to build with the tools and SDK, as they hadn't been updated for this release. Looks like this is affecting many react-native projects.
More details can be found here: https://github.com/react-community/react-native-image-picker/issues/882#issuecomment-405255785
I think this issue because cached files.
I recommend Clean project and clear Android Studio cache by menu File`”Invalidate Caches and Restart…”`
And reboot computer so make Gradle sync again

android pre dex errors in Android Studio

I recently try to open up a project developed sometime ago into Android Studio and try to rebuild it and I get whole load Android Pre Dex errors which I am totally stuck how I get rid of them. Tried a lot of stuff such as changing Android API level, cleaning, change jdk version.. all doesn't work.
Any experts out there can enlighten me what is the likely cause of these errors.?
android pre dex errors screenshot
Step 1: Add multidex enabled in default config
defaultConfig {
applicationId "Your package name"
minSdkVersion 16
targetSdkVersion 23
versionCode 5
versionName '1.0.5'
multiDexEnabled true
}
Step 2 : Add this library in your dependencies
compile 'com.android.support:multidex:1.0.0'
Step 3 : Add this line in your MyApplication extends Application java class
MultiDex.install(this);
Step 4: Don't forgot to call MyApplication class in your Application tag of manifest file. Like this
android:name=".MyApplication"
After this 4 steps clean your project and run the application. Surely it will helps you!
Happy Coding!
i already solved it
it happen because you didnt setting the default java in android studio 2.3.3 or android studio 3.0 beta 6
go to file > project structure > SDK location
change the JDK Location to C:\Program Files\Java\jdk1.8.0_131

Compile errors when importing ArduDroid to Android Studio

Im importing this old ArduDroid project (https://github.com/xgxzatx/ArduDroid) into Android Studio 1.5.1. At first I got an unrecoverable error due to the ActionBarSherlock library and Android Studio wouldn't even import the project. I followed a post that suggested commenting out the call in project.properties for that library and then importing, so I did and the project imported successfully into Android Studio. Then I downloaded the ActionBarSherlock folder and put that into my project folder so it is recognized, which it is.
Now I've gotten quite a few errors asking for a different SDK and build tools. So far I've tried SDK 19 and the default 22 which I guess installed with Android Studio. The problem seems to be that the ActionBarSherlock seems to be set for SDK 19 but the project seems to be set at a different SDK. I also believe it has something to do with ActionBarSherlock only compiling as far up as SDK 19.
Currently these are my settings:
Ive installed SDK's:
22
19
15
AndroidProject
AndroidManifest.xml>>>min:15, target:15
build.gradle>>>>>>>>>>compile:15, buildTools:22.0.1, min:15, target:15
ActionBarSherlock
AndroidManifest.xml>>>min:15, target:15
build.gradle>>>>>>>>>>compile:19, buildTools:19.1.0
project.properties>>>>target=android-15
Now I'm getting:
Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock'
Ok, I removed the entire project folder from my workspace and started over again:
Commented out this line in the project.properties using TextEdit:
android.library.reference.1=../../JakeWharton-ActionBarSherlock-e5c2d1c/library
Imported the project into Android Studio.
Noticed I have a Project build.gradle, Module build.gradle.
Did not paste the ActionBarSherlock folder into the project in Android Studio this time.
Added these lines to the Module build.gradle:
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:18.0.0'
}
Left Module build.gradle as:
compileSdkVersion 15
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.xgxzatx.ardudroid"
minSdkVersion 8
targetSdkVersion 15
}
Left AndroidManifest.xml with min=8 and target=15
However when I run the app on my phone I just get a blank screen with a Configuration tab and a Monitoring tab, but ArduDroid is supposed to have lots of buttons and sliders and a few text fields at the bottom, like this:
but what I get is like this:
So Im guessing this might have been a work in progress that the author never finished? Can anyone else run the project and confirm?

Cannot compile MPChartExample from MPAndroidChart package in Android

I have updated gradle that comes with MPChartExample to 1.0.0 and when trying to compille it below message is thrown:
Gradle 'MPChartExample' project refresh failed.
Error:Library projects cannot set applicationId. applicationId is set to 'com.github.mikephil.charting' in default config.
What am I doing wrong?
In your library\app level build.gradle remove the applicationId. Libraries do not require an id. It is for applications.

Cant find `uses-sdk` in Android Studio 0.8.2

I started to learn android using Android Studio 0.8.2 and I started a new project with the minimum API as 15. But in my AndroidManifest.xml, doesn't appear the uses-sdk tag.
Do I have to insert it by myself? Shouldn't the project create it? Or is Android Studio different and is no longer necessary to insert this in manifest, only in the build.gradle?
Thank you in advance :)
The default template in Android Studio is ready to work with gradle.
If you check your project you will find a build.gradle file inside your app module.
Here you can find something like this:
defaultConfig {
applicationId 'xxxx'
minSdkVersion 15 //your minSdk
targetSdkVersion XX //your targetVersion
versionCode 0
versionName '0.1.0'
}
Gradle building the project will override the uses-sdk tag in your Manifest.
Yes, add it manually.
Android studio uses build.gradle to build the project so it doesn't care about the manifest, and that's probably why it doesn't insert it in it. However, it is important to have it in the manifest, for when you publish the app, as Google play uses this for filtering the devices.

Categories

Resources