Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android build fails when adding the plugin #46

Closed
ickata opened this issue Jul 6, 2016 · 9 comments
Closed

Android build fails when adding the plugin #46

ickata opened this issue Jul 6, 2016 · 9 comments

Comments

@ickata
Copy link

ickata commented Jul 6, 2016

Hi,

Build on Android fails on my side after I add the plugin. Here are steps to reproduce:

  1. Checkout sampleGroceries app: git clone git@github.com:NativeScript/sample-Groceries.git
  2. Checkout "start" branch: git checkout start
  3. Add android platform: tns platform add android
  4. Add the plugin: tns plugin add nativescript-google-maps-sdk
  5. Build: tns build android

Here is the error:

WARNING: The file: /Users/ickata/Desktop/Tables/tns/sample-Groceries/node_modules/nativescript-google-maps-sdk/platforms/android/AndroidManifest.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0
WARNING: The file: /Users/ickata/Desktop/Tables/tns/sample-Groceries/node_modules/nativescript-google-maps-sdk/platforms/android/res/values/nativescript_google_maps_api.xml is depricated, you can read more about what will be the expected plugin structure here: https://www.nativescript.org/blog/migrating-n-android-plugins-from-version-1.7-to-2.0

:config phase:  createDefaultIncludeFiles
    +found plugins: nativescript-google-maps-sdk
Renaming plugin directory to flavor name: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/src/nativescript-google-maps-sdk -> /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/src/F0
    +found plugins: tns-core-modules-widgets
Renaming plugin directory to flavor name: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/src/tns-core-modules-widgets -> /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/src/F1

:config phase:  createPluginsConfigFile
     Creating product flavors include.gradle file in /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/configurations folder...

:config phase:  pluginExtend
    +applying configuration from: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/configurations/include.gradle
    +applying configuration from: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/configurations/nativescript-google-maps-sdk/include.gradle
    +applying configuration from: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
    +adding dependency: /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/libs/aar/widgets-release.aar

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'sampleGroceries'.
> Could not resolve all dependencies for configuration ':_F0F1DebugCompile'.
   > Could not find any matches for com.google.android.gms:play-services-maps:+ as no versions of com.google.android.gms:play-services-maps are available.
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/android/gms/play-services-maps/maven-metadata.xml
         https://jcenter.bintray.com/com/google/android/gms/play-services-maps/
         file:/Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/libs/aar/
         file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/maven-metadata.xml
         file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/
     Required by:
         :sampleGroceries:unspecified

* 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: 8.026 secs
Command /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/gradlew failed with exit code 1
# build android
┌─────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Usage   │ Synopsis                                                                                                                                                                                 │
│ General │ $ tns build android [--compileSdk <API Level>] [--key-store-path <File Path> --key-store-password <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [--release] │
│         │ [--static-bindings] [--copy-to <File Path>]                                                                                                                                              │
└─────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.

### Options

    * --compileSdk - Sets the Android SDK that will be used to build the project.
    * --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
    * --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --copy-to - Specifies the file path where the built .apk will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.

### Attributes
<API Level> is a valid Android API level. For example: 22, 23.

Before adding the plugin I was able to build for android and to run the demo app in the emulator. So my setup should be fine.

Let me know if you need additional information.

@dapriett
Copy link
Owner

dapriett commented Jul 6, 2016

Please follow the directions on the readme. This means you don't have the Android google play services SDK installed on your computer:

* What went wrong:
A problem occurred configuring root project 'sampleGroceries'.
> Could not resolve all dependencies for configuration ':_F0F1DebugCompile'.
   > Could not find any matches for com.google.android.gms:play-services-maps:+ as no versions of com.google.android.gms:play-services-maps are available.
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/android/gms/play-services-maps/maven-metadata.xml
         https://jcenter.bintray.com/com/google/android/gms/play-services-maps/
         file:/Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/libs/aar/
         file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/maven-metadata.xml
         file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/
     Required by:
         :sampleGroceries:unspecified

@dapriett dapriett closed this as completed Jul 6, 2016
@ickata
Copy link
Author

ickata commented Jul 6, 2016

I installed the package, but I have the same issue:
http://imgur.com/P1KVfiO

@dapriett
Copy link
Owner

dapriett commented Jul 6, 2016

Probably have the wrong ANDROID_HOME set on your computer. It looks like it's looking in /usr/local/opt/android-sdk, but the image you sent has the sdk path at /usr/local/Cellar/android-sdk

@ickata
Copy link
Author

ickata commented Jul 6, 2016

That's not the problem. /usr/local/opt/android-sdk is a symlink to /usr/local/Cellar/android-sdk/24.4.1_1:

$ ls -la /usr/local/opt/android-sdk
lrwxr-xr-x  1 ickata  admin  30  4 Май 18:58 /usr/local/opt/android-sdk -> ../Cellar/android-sdk/24.4.1_1

@dapriett
Copy link
Owner

dapriett commented Jul 6, 2016

Maybe try installing Google Respository in your SDK manager.

@ickata
Copy link
Author

ickata commented Jul 6, 2016

OK, I installed "Google Repository". Now I have the following error (I hope this will be the last one):

:mergeF0F1DebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mergeF0F1DebugResources'.
> /Users/ickata/Desktop/Tables/tns/sample-Groceries/platforms/android/src/main/res/values/nativescript_google_maps_api.xml: Error: In DataSet 'main', no data file for changedFile. This is an internal error in the incremental builds code; to work around it, try doing a full clean build.

Can you please give me some directions?

@krisidmisso
Copy link

@ickata did you solve this?

@ickata
Copy link
Author

ickata commented Feb 13, 2018

Yes, long time ago, but don't remember how :)

It is very important to have latest version of {N} and plugins. Also take a look at the App_Resources/Android/app.gradle file which is the version of Google Play Services (googlePlayServicesVersion). A lot of plugins are using it, some of them may require larger version than yours.

Good luck!

@esshx8
Copy link

esshx8 commented Aug 22, 2018

C:\Users\user\AndroidStudioProjects\FunFacts\app\src\main\res\values\dimens.xml:
Error: In DataSet 'main', no data file for changedFile. This is an internal error in the incremental builds code; to work around it, try doing a full clean build.

Scott Junner
on May 12, 2017
If you open the Build menu at the top of AndroidStudio, you will see two options there of interest to you. "Clean Project" and "Rebuild Project".
Try those one after the other and see what results you get. Other than that I don't really know.

It works for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants