benoitletondor / Android-Studio-MVP-template

Android MVP template for Android Studio
Apache License 2.0
627 stars 121 forks source link

MVP template not working in android 3.0 #9

Open mhdtouban opened 7 years ago

mhdtouban commented 7 years ago

Following the instructions, you have on the homepage. When I copied the MVP activities to the android studio directory the Android Studio Application got damaged. However, when I followed the same instruction on android 2.3 everything went well.

benoitletondor commented 7 years ago

Hi there,

Indeed Android Studio 3.0 on macOS changes the way the app is signed and thus you cannot change any file inside the app bundle without breaking the signature.

I have a temporary workaround that consists in un-signing the app:

./unsign /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/MacOS/studio
mv /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/MacOS/studio.unsigned /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/MacOS/studio

You can now execute Android Studio 3.0 and it should work !

Note that GateKeeper won't allow you to start AS 3.0 since it's not signed anymore, follow Apple's instructions to run it: https://support.apple.com/kb/PH25088?locale=en_US

benoitletondor commented 7 years ago

Note that the method described in my previous answer seems to kinda break the auto update process.

The window tells that update is impossible but it seems to be working, it needs to be examinated

asrulsibaoel commented 6 years ago

I've followed your instruction @benoitletondor but, still got same error


==> applicationPackage  [in template "root://activities/MVPActivity/root/src/app_package/classes/Activity.java.ftl" at line 6, column 10]

Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction:
==> ${applicationPackage}  [in template "root://activities/MVPActivity/root/src/app_package/classes/Activity.java.ftl" at line 6, column 8]
FreeMarker template error:
The following has evaluated to null or missing:
==> applicationPackage  [in template "root://activities/MVPActivity/root/src/app_package/classes/Activity.java.ftl" at line 6, column 10]

Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction (FTL stack trace):
----------
==> ${applicationPackage}  [in template "root://activities/MVPActivity/root/src/app_package/classes/Activity.java.ftl" at line 6, column 8]
----------

Java stack trace (for programmers):
----------
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
    at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98)
    at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:382)
    at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115)
    at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.MixedContent.accept(MixedContent.java:93)
    at freemarker.core.Environment.visit(Environment.java:265)
    at freemarker.core.Environment.process(Environment.java:243)
    at freemarker.template.Template.process(Template.java:277)
    at com.android.tools.idea.templates.FreemarkerUtils.processFreemarkerTemplate(FreemarkerUtils.java:96)```
benoitletondor commented 6 years ago

Hi @asrulsibaoel,

I checked your report and made a little fix, it's released with the 2.2.2 tag. You can pull the last code from the repo and it should work ok now.

Thank you for reporting the issue.