bakerframework / baker-android

Baker Android Repository
50 stars 29 forks source link

Problem Gradle sync #20

Closed Marzio1 closed 10 years ago

Marzio1 commented 10 years ago

I'm working and studying Baker Project to publish on iOS and GooglePlay Android For iOS I arrived at a good point and I've almost solved all the major problems.

For Android instead I started over again from the beginning, following the tutorial, but I was always stopped by the synchronization Gradle and I can not finish the setting of the project.

My system is: Mac OSX 10.9.2 Maverick Android 0.5.2 Study

JAVA JDK 1.7.0 or 1.8.0

This a Maven Version xxxxxxxxxxxxxxxx$ mvn --version Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00) Maven home: /usr/local/Cellar/maven/3.2.1/libexec Java version: 1.8.0_05, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre Default locale: it_IT, platform encoding: UTF-8

OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"

This is result ./gradlew install BUILD SUCCESSFUL

Total time: 38.998 secs

This is the error of Gradle

Gradle 'XXXXX' project refresh failed: Cannot invoke method repositories() on null object Gradle settings

BUILD .GRADLE file apply plugin: 'android'

android { compileSdkVersion 19 buildToolsVersion "19.0.3"

defaultConfig {
    minSdkVersion 11
    targetSdkVersion 17
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

}

dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.baker:ABaker:1.1' }

apply plugin: 'android' repositories { maven { url 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath }

}

In the MAIN.ACTIVITY file some red errors the first error is import android.support.v7.app.ActionBarActivity;

with ActionActibity in red

In the ANDROIDManifest.xml after copy from Baker and replacement name package some red errors the first erro is: android:value="@integer/google_play_services_version" />

with @integer/google_play_services_version in red

I've seen that others have the same problem, so I think it is necessary to explain how to intervene to resolve

thank you very much

Marzio1 commented 10 years ago

I do not know why the copy paste some text was changed the font size I'm sorry,

fcontreras commented 10 years ago

Hi @Marzio1,

Yes other have been having the issue but we haven't had enough info to reproduce, I see you posted most of what your environment have and we do appreciate it, we will be working on reproducing with the information you pasted.

We'll get to you as soon as possible.

fcontreras commented 10 years ago

Hey @Marzio1

I finally found the issue based on the info you posted, btw.. thanks since this was hurting the project. The thing is you guys were copy pasting the code as it was on the Wiki.. and yes the code was not correctly rendered by Markdown so it was not showing the line breaks.

These two (shown in the code block below) should be in different lines and also apply plugin: 'android' is already added by your code template, so you just have to add the repository part.

apply plugin: 'android' <- This is already in you gradle.build file
repositories { <- You will add from this line below.
    maven {
        url 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
    }
}

If you fix that your project should sync successfully.

I also fixed the wiki page so it reflects the right way to do it. Thanks!

fcontreras commented 10 years ago

Please let us know how did it go

Marzio1 commented 10 years ago

Thank You I made ​​the corrections Now I go to rename the Package Name in the file AndroidManifest.xml but I only rename the package to the third row, or all the "com.baker.abaker"?

fcontreras commented 10 years ago

In the AndroidManifest.xml file there are three lines to check:

  1. The package name in third line as you see.
  2. The versionCode next line (1 as default you may need to change it when it comes to do another release of your app)
  3. The versionName the following one (1.1 you can set it as you want it to appear in the Google Play store, I would say normally 1.0 in the first release since its 1.1 because of the ABaker version but that doesn't need to be the same as your app)

Other than that as you follow the guide there are some other customisation tasks to be done. :) glad you were able to solve the repositories issue.

Marzio1 commented 10 years ago

Now I have 3 red error in the Main Activity:

Cannot resolve R symbol .... R.layout....

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); }

Marzio1 commented 10 years ago

And one red error in Manifest:

android:label="@string/app_name" >

fcontreras commented 10 years ago

Hi, for the Main activity try this https://github.com/bakerframework/baker-android/wiki/Creating-your-own-Baker-Android-Project#cannot-find-symbol-variable-activity_main

For the Manifest.. should be solved when you finish the customisation, since you have to replace the current string resources of the project with the ones form baker which includes the app_name

Marzio1 commented 10 years ago

Ok finally the synchronization is successful Now proceed to the customization and if I doubt I will alert you

Marzio1 commented 10 years ago

Sorry but before customizing, following the tutorial I should run my project But how should I start the project? Run App or run App engine or Run My Project run engine? And with what configuration?

Marzio1 commented 10 years ago

I started again from the beginning and I got to the point 13 Launching APP start the home of simulator but without the App Baker I copied the folders red and assets (Point 1 and 2 customization) Then I launched the app again, to see the result with documents demo of Baker,

But I receive this error:

Error:Execution failed for task ':app:compileDebugJava'.

Compilation failed; see the compiler error output for details. /Users/----------/App_Android/baker-android-master/---------/app/src/main/java/--/----/----/----/---/MainActivity.java Error:(14, 32) error: cannot find symbol variable activity_main

Error:(22,41) error: cannot find symbol variable main

Checking the code I found the red error still: ...... In file AndroidManifest.xml android:label="@string/app_name" > ----Header expected Manifest file doesn't end with a final newline less... (⌘F1) Checks whether a manifest file ends with a final newline (as required by the JAR file specification). ---- ........ in file MainActivity setContentView(R.layout.activity_main); --- Cannot resolve symbol activity_main --- getMenuInflater().inflate(R.menu.main, menu); --- Cannot resolve symbol main ---

fcontreras commented 10 years ago

Hi @Marzio1

You are still having issues with the default main activity created by AS.. please check this again https://github.com/bakerframework/baker-android/wiki/Creating-your-own-Baker-Android-Project#cannot-find-symbol-variable-activity_main

Marzio1 commented 10 years ago

Ok I go to delete all projects and Baker master and i restart

Marzio1 commented 10 years ago

when arrive to ./gradlew install this error

fcontreras commented 10 years ago

local.properties is a file that define values for your local environment only, if AS does not creates it... you can feel free to do it yourself.

What this is pointing, is that you need to define sdk.dir (path where your SDK is located) into your local properties so it can be found when sync.

Marzio1 commented 10 years ago

But where is this file?

fcontreras commented 10 years ago

The file should be in your module root directory. Example (module name 'test') /project folder/test/local.properties

As a guidance you can find in the gradlew file.

Marzio1 commented 10 years ago

Ok thank you. The ./gradlew install is correct Now I go to create my project

Marzio1 commented 10 years ago

Hello I got to the point 13 and I always have a red error in the file AndroidManifest.xml android:label="@string/app_name" > However,, the project ends successfully the run but in the simulator the Baker app does not appear

fcontreras commented 10 years ago

I see.. as seems there is an issue with the docs.. since you should not be able to run the project until you finish the "Customising your Baker Android Project" steps.

Marzio1 commented 10 years ago

In the tutorial: Sync your gradle files. Run your project

I proceed with the customization and see what happens

Marzio1 commented 10 years ago

I copied Assets and Res by Baker to My Project with the settings Baker

Unfortunately, when run I have the same errors

Error:Execution failed for task ':app:compileDebugJava'.

Compilation failed; see the compiler error output for details. /Users/xxxxxxxx/App_Android/baker-android-master/yyyyyyyyyy/app/src/main/java/it/edimg/cxauto/app/MainActivity.java Error:(14, 32) error: cannot find symbol variable activity_main

Error:(22, 41) error: cannot find symbol variable main

I'm a little disheartened If you want and if it helps I can provide a link to download the entire zipped project to analyze the errors

fcontreras commented 10 years ago

From what you've done I see you reach the same point when you need to update your main class as this suggest https://github.com/bakerframework/baker-android/wiki/Creating-your-own-Baker-Android-Project#cannot-find-symbol-variable-activity_main

I'm sorry the wiki is not good enough yet to help you build the project successfully but we have been updating it as people ask questions about how to build it.

I can surely check your project if you provide a link to download it, it is important to us you can build your project and verify our wiki to make things go smoother. Let me know.

Marzio1 commented 10 years ago

Hello I started everything from the beginning , uninstalling and reinstalling Android Studio I then created a new project Baker following the new tutorial (with the Create Activity unchecked) I kept for the moment configurations Baker to try if it works with the demo publications As a first consideration it seems to me that the libraries proposed in the tutorials are not enough Certainly, the project required the library 11, but for safety I installed all the libraries and all the extras

Finally, in the project remains one red error in AndroidManifest.xml Always the same: android:label="@string/app_name" ALERT: Header expected - Manifest file doesn't and with a final newline Checks whether a manifest file with a final newline (as required by JAR file specification)

to run the project (MonoForAndroid_Api_12 virtual device Emulator) I receive an error:

Waiting for device. "/Applications/Android Studio.app/sdk/tools/emulator" -avd MonoForAndroid_API_12 -netspeed full -netdelay none

Device connected: emulator-5554 Device is online: emulator-5554 Target device: MonoForAndroid_API_12 [emulator-5554] Uploading file local path: /Users/xxxxxxxxxxx/App_Android/baker-android-master/yyyyyyy/app/build/apk/app-debug-unaligned.apk remote path: /data/local/tmp/it.kkkkkkkk.zzzzzzz.app Installing it.kkkkkkkk.zzzzzzz.app DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/it.kkkkkkkk.zzzzzzz.app" Error: Could not access the Package Manager. Is the system running?

I hope I was helpful

Marzio1 commented 10 years ago

For the problem android:label="@string/app_name" The bulb of Android Studio suggest:

fcontreras commented 10 years ago

Hi @Marzio1 Im goin to publish a Video Tutorial today... mostly later tomorrow.. I hope it helps you solve this issue.

Marzio1 commented 10 years ago

thanks I hope so too, because I want to finish soon I have not been able to verify the reading of the documents, but I hope it can be used the same shelf.json of iOS version

fcontreras commented 10 years ago

Hi @Marzio1 I published one of the videos on the wiki, you can find it on youtube here https://www.youtube.com/watch?v=hCMs80I1cx8

Marzio1 commented 10 years ago

Hello Francisco

the video is perfect, and little different from the Text tutorial Now I created a new project following step by step exactly the video Tutorila and finally it work. The only little problem is that it is always a red warning in the AndroidManifest.xml file, at line android:label="@string/app_name" > But with emulator work Now I go to test all performances comparing with the iOS version

Thank You Very much

fcontreras commented 10 years ago

See... if rebuilding the project helps.. Let me know if we can close this ticket.

Marzio1 commented 10 years ago

The project now works with the emulator. I have no chance to test it with an device, because I just iOS What leaves me doubtful is that persistent red error that could possibly create problems during compilation and inclusion in GooglePlay. I want to know if it happens only to me or not. But I hope you can solve this problem We can close this ticket. I bother you with new tickets for individual requests or problems using the app

fcontreras commented 10 years ago

Thanks that issue is common with Android Studio.. I have seen it .. and is just that sometimes its not able to find some resources for editing propose... I don't think it will cause any issue.

Either way let us know. Regards