I am working at Windows 7 OS, Android Studio. After compiling AndroidAnnotation framework, I can not compile project. Right during the process of compiling it responds with "Error:Could not find the AndroidManifest.xml file, using generation folder"
My gradle file is:
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.falcodeceo.beautifulmind"
minSdkVersion 16
targetSdkVersion 24
versionCode 23
versionName "2.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.android.support:palette-v7:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.eightbitlab:blurview:1.1.2'
compile 'org.androidannotations:androidannotations:4.1.0'
}
Looked through some answers but can not apply it, as I do not understand how it works. So I will be thankful if you explain how it all goes.
You miss some necessary configuration. Just add following parts to your Gradle file
buildscript {
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'android-apt'
dependencies {
apt "org.androidannotations:androidannotations:4.1.0"
}
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
}
}
More details can be found at androidannotations wiki https://github.com/excilys/androidannotations/wiki/Building-Project-Gradle
Related
I added the following line to my build.gradle(Module:app):
compile 'com.android.support:design:21.0.3'
But when executing Gradle I'm getting
Failed to resolve: com.android.support.design:21.0.3
I got that code from the android support design library and added it to a new project. I added it to the dependency section as such:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId 'com.solodroid.androidnewsapp'
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:design:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:recyclerview-v7:21.+'
compile files('libs/StartAppInAppPlus-2.3.jar')
}
Use the same version of appcompat as your sdk version. Also in newer android studio use implementation keyword.
implementation 'com.android.support:appcompat-v7:26.1.0'
IMP
Or first check your sdk that you have downloaded the version 21.0.3.
You should add official google repository in app gradle. Also on project gradle if other modules need that repository.
apply plugin: 'com.android.application'
buildscript {
repositories {
google()
}
}
...
android {
...
After updating android studio to version 3.0, I can't preview layout of my app, I get the error like:
'Failed to load AppCompat ActionBar with unknown error'.
How can I fix this? but if I run the app on my device phone, its run normally.
This is my Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.halloo'
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
}
dependencies {
compile 'com.squareup.okhttp3:okhttp:3.5.0'
}
dependencies {
compile 'com.android.support:support-v4:24.+'
}
dependencies {
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
}
dependencies {
compile 'com.android.support:support-v4:24.+'
compile 'junit:junit:4.12'
}
dependencies {
compile 'com.android.support:support-v4:24.+'
compile 'com.mikhaellopez:hfrecyclerview:1.0.0'
}
Thank you very much for your time and assistance in this matter.
First, you need to use the same version of compileSdkVersion, buildToolsVersion, targetSdkVersion, and support library version. I see that you want to use buildToolsVersion '26.0.2'. So, change all of them to version 26.
Second, you need to clean up your build.gradle. There is no need for duplicate dependencies.
Third, try clean and build your project. As the last resort, try File -> Invalidate Caches/Restart...
Your app build.gradle should be something like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.halloo'
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.squareup.okhttp3:okhttp:3.5.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.mikhaellopez:hfrecyclerview:1.0.0'
testCompile 'junit:junit:4.12'
}
You also need to check for your project build.gradle. It should contain build:gradle:3.0.0 (as #dheeraj-joshi has pointing out), something like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
// maven { url "https://maven.google.com" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Then, you need to check your gradle version. It should at least using gradle-4.1.
I had similar problem (maybe not exactly the same one).
I was able to run the starter code on the phone and the menu was there. However, preview pane in Android Studio didn't show actual layout.
I have fixed it by changing Theme.AppCompat.Light.DarkActionBar to Base.Theme.AppCompat.Light.DarkActionBar in styles.xml.
This is a bug in android support library version "26.0.0-beta2'
use:
compile 'com.android.support:appcompat-v7:24.2.1'
with:
buildToolsVersion '26.0.0'
and
classpath
'com.android.tools.build:gradle:3.0.0-alpha8'
everything should work fine.
I am using "robovm-rt-1.13.0" (an encryption-decryption library) in my android project. After encrypting when I try to build the project, I get the following error:
Error:Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
java.lang.SecurityException: Prohibited package name: java.lang
And below is my build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.athansys.patient.athansys"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
cruncherEnabled = false
}
}
repositories {
maven { url "https://jitpack.io" }
}
ext {
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.2'
compile 'com.google.code.gson:gson:2.7'
compile project(':robovm-rt-1.13.0')
}
Could someone help me sort this issue.
Thanks in advance!
You cannot use java or javax as the name of your package. Replace it to something else.
java.lang.SecurityException: Prohibited package name: java
Edit: Move your Main.java file in a (source) directory that doesn't start with java or javax and use the directory structure names to change your package name in the code.
No problems with Dependencies .
I have some problems with integration MapBox SDK into my project.
Here is description how to add dependency into Gradle:
https://www.mapbox.com/mapbox-android-sdk/#gradle
So, I should add this into my build.gradle:
repositories {
mavenCentral()
}
dependencies {
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4#aar'){
transitive=true
}
}
After that my build.gradle looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.samusko.journeyproject"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:cardview-v7:22.1.1'
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4#aar'){
transitive=true
}
}
When I compile this I have this error:
Error:Failed to resolve: com.android.support:support-v4:22.2.0
I don't know what is wrong :(.
Please help me to resolve this error..
You are missing this line in the gradle file, put it before the "com.mapboxsdk:..." line (the support libraries you used were too old):
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
##### begin fix
# modified 2.1.1 to 2.2.0
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
##### end fix
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.4#aar'){
transitive=true
}
}
Note that this version of MapBox is no longer supported upstream. They deprecated it, even tough (IMHO) as I am writing this message the new API is not usable enough.
I have a library project which had colliding xml names like activity_login,etc..
Now even though this is the case when I run the Actvity in the library project is inflating my xml instead of its own and subsequently throwing NPE.
I've already tried giving it the fully qualified R file name but it still seems to be inflating the wrong file.
Ps:I've tried clean build doesnt work either on AS1.2.1.1.
Is this a bug of AS or am I doing something wrong
Here is my gradle file
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.xxx"
minSdkVersion 14
targetSdkVersion 21
versionCode 17
versionName "2.4.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:recyclerview-v7:22.0.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile project('libraries:holograph')
compile project('libraries:facebook')
compile files('libs/google-api-client-android-1.18.0-rc.jar')
compile files('libs/google-api-client-java6-1.18.0-rc.jar')
compile files('libs/google-api-client-1.18.0-rc.jar')
compile 'com.crashlytics.android:crashlytics:1.+'
compile project(':chartlib')
compile project(':payu')
}
And build.gradle of payu is
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 2
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile('de.keyboardsurfer.android.widget:crouton:1.8.+#aar') {
exclude module: 'support-v7'
compile 'com.android.support:appcompat-v7:18.0.+'
}
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'de.greenrobot:eventbus:2.2.1'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.mobsandgeeks:android-saripaar:1.0.3'
compile project(':CustomBrowser')
}
And my Settings.gradle
include ':app', ':payUMoneysdk', ':CustomBrowser'
This is happening by design, consider it as overriding the library activity layout. I use it extensively for Strings, Colors etc. where it's more useful.
Just rename your projects XML layouts.