Issues cleaning my project and importing R after update - android-studio

I just updated Android Studio (0.8.14) and got bombarded with various errors.
When I try to clean my project, I get this:
Error:Execution failed for task ':app:clean'.
> Unable to delete directory: C:\Users\----\Documents\Android Projects\----\app\build\intermediates
Every class that imports com.myorg.myproject.R says:
Cannot resolve symbol 'R'.
I checked my androidmanifest and it's referencing the package correctly. Any idea how to fix this?
gradlew clean in the terminal works without error, but the clean function from the Build menu throws this error.
C:\Users\----\Documents\Android Projects\---->gradlew clean
:app:clean
BUILD SUCCESSFUL
Total time: 5.43 secs
Thanks

Related

Android Studio 3.6.3 How to get rid of ERROR: Unable to resolve dependency for ':app#debug/compileClasspath' (androidx.fragment:fragment)

I'm tired of getting this error every third/fourth time I try to build project:
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve androidx.fragment:fragment:[1.2.0].
Show Details
Affected Modules: app
It also effects ':app#debugUnitTest/compileClasspath' and ':app#debugAndroidTest/compileClasspath' (shows the same error for them).
Also sometimes it goes after the following build error (internet connection is surely stable):
Unknown host 'repo.maven.apache.org: nodename nor servname provided, or not known'. You may need to adjust the proxy settings in Gradle.
Enable Gradle 'offline mode' and sync project
Learn about configuring HTTP proxies in Gradle
There were no changes in build.gradle files or any other gradle files before this error came.
It would be nice if you help to get rid of it. Gradle-plugin version = "1.3.71".

Gradle Problem When Importing Flutter Project From Git

I imported a Flutter Project from this git repo: https://github.com/gligerglg/geodropin (website: https://itsallwidgets.com/geodropin) by copying the HTTPS, then go to Android Studio -> Check out Project from Version Control -> Git. When I open the project and try to run, this error appear:
* Error running Gradle:
ProcessException: Process "/Users/phuctruong/AndroidStudioProjects/geodropin/android/gradlew" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/phuctruong/AndroidStudioProjects/geodropin/android/app/build.gradle' line: 45
* What went wrong:
A problem occurred evaluating project ':app'.
> For input string: "1.01"
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Command: /Users/phuctruong/AndroidStudioProjects/geodropin/android/gradlew app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
I assume this has something to do with my gradle version and the project's gradle version? I'm a newbie to Flutter so my understanding of gradle is limited. When I check gradle-wrapper.property it said i'm using gradle 4.10.2
Thanks for helping.
Check out the 16th line of app/build.gradle you will see that the number in a string is of float type. VersionCode should always be integer. Check this out https://developer.android.com/studio/publish/versioning
You can remove this error by just changing it to positive integer value like this :
flutterVersionCode = '1'
Now this problem is resolved but however you will get another error related to androidX but thats different question.
Error would be :
BUILD FAILED in 10s
******************************************************************************************* The Gradle failure may have been because of AndroidX incompatibilities
in this Flutter app. See link for more information on
the problem and how to fix it.
******************************************************************************************* Finished with error: Gradle task assembleDebug failed with exit code 1
For this issue you need to migrate the project to androidX,
add it in android/gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
Or if its already there, Check this migration docs for more info.
Or nothing works, you can ask another question.

adding npm module to Tabris results in a failed build with cordova

Being rather new to mobile app development i'm looking at Apache Cordova paired with Tabris.
Tabris requires a particular installation procedure, this creates a ./node_modules sub-folder under the regular ./www folder of a typical cordova project. Build cordova here is not a problem.
After adding 'npm install pouchdb' to ./www/node_modules now the cordova build fails again and again. I don't see what else changed but the addition of pouchdb. Strangely while pouchdb is reported to be just 46KB after installation many more modules were added and it now weighs in at 55MB. I suspect the many extra modules pose an issue.
I suspect i may need to tweak gradle but i'm most clueless where to start.
please advise
--- below the output indicating build failure
.... many lines of output preced
:processDebugManifest
:processDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/opt/android-sdk-update-manager/build-tools/24.0.2/aapt'' finished with non-zero exit value 1
<<< this is supposedly output from gradle >>>
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Total time: 13.708 secs
Error: Error code 1 for command: /usr/sources/mobile/.../platforms/android/gradlew with args: cdvBuildDebug,-b,/usr/sources/mobile/.../platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
... replace path for anonymisation
<<< is my own inserted line >>>
First off: are you using Tabris or Tabris.js? The former is a Java framework and is not compatible with Cordova. The latter is, but if you're trying to use Tabris.js as a slave to Cordova (i.e. using the Cordova build command) that's not going to work. Instead I suggest you convert your project structure Tabris.js's style and then run the build there. If you still encounter errors when after converting your structure and building with Tabris.js, post the full build log in the Tabris.js issue tracker.

A library uses the same package as this project

For 2 days, I have been trying to fix my Android Studio setup, but despite a lot of googling have had no luck fixing this problem. Gradle keeps giving me the error
Error:Execution failed for task ':Android-Tabbedout-30:processQaReleaseResources'.
Error: A library uses the same package as this project
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
If I add in the enforceUniquePackageName=false to the gradle file, then the project can be successively refreshed by Gradle, but once I try to run it I get this error:
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define
Any ideas on how to fix this?
I was searching for that same problem and i find this on github
https://github.com/DWorkS/AStickyHeader/issues/12
And this solved my problem.
All this says is to rename the package name on the AndroidManifast.xml file.
And its done.

Apportable load the tweejump-master makes errors

I try to use apportable to load the demo to my android phone.but have errors.
localhost:tweejump-master zhangxueyuan$ apportable load
Building with TARGET_ARCH_ABI:armeabi ARM_NEON:False
Building to /Users/zhangxueyuan/.apportable/SDK/Build/android-armeabi-debug
Warning: Falling back to toolchain version 4.7. Please run 'apportable update_toolchain'
Error: Could not find file /Users/zhangxueyuan/Downloads/android-ndk-r9/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86/bin
and
localhost:tweejump-master zhangxueyuan$ apportable build
Building with TARGET_ARCH_ABI:armeabi ARM_NEON:False
Building to /Users/zhangxueyuan/.apportable/SDK/Build/android-armeabi-debug
Warning: Falling back to toolchain version 4.7. Please run 'apportable update_toolchain'
Error: Could not find file /Users/zhangxueyuan/Downloads/android-ndk-r9/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86/bin
I refer to this link,and I think if the apportable will create a file to compile the project .
I think maybe change one file in the Folder:~/.apportable/SDK/site_scons/build/。
thanks
ok,i have find the answer。
i change the file /Users/zhangxueyuan/.apportable/SDK/site_scons/android/ndk.py
the number 303 to env['NDK_VERSION'] = '4.8'.
then
i apportable build the project again.
the result have errors: Could not find file /Users/zhangxueyuan/Downloads/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86/bin
i find the only have the drawin-x86-64.
so i copy them by myself
use cp -R darwin-x86_64/ darwin-x86/
and try build project again.
apportable run ok!

Resources